micro/tunnel/link.go

38 lines
759 B
Go
Raw Normal View History

2019-08-29 14:42:27 +03:00
package tunnel
import (
2019-08-30 22:05:00 +03:00
"sync"
"time"
2019-08-29 14:42:27 +03:00
"github.com/google/uuid"
"github.com/micro/go-micro/transport"
)
2019-08-30 22:05:00 +03:00
type link struct {
sync.RWMutex
transport.Socket
// unique id of this link e.g uuid
// which we define for ourselves
id string
// whether its a loopback connection
// this flag is used by the transport listener
// which accepts inbound quic connections
loopback bool
// whether its actually connected
// dialled side sets it to connected
// after sending the message. the
// listener waits for the connect
connected bool
// the last time we received a keepalive
// on this link from the remote side
lastKeepAlive time.Time
}
2019-08-29 14:42:27 +03:00
func newLink(s transport.Socket) *link {
return &link{
Socket: s,
id: uuid.New().String(),
}
}