Documentation
¶
Overview ¶
Package tunnel provides gre network tunnelling
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DiscoverTime sets the time at which we fire discover messages DiscoverTime = 30 * time.Second // KeepAliveTime defines time interval we send keepalive messages to outbound links KeepAliveTime = 30 * time.Second // ReconnectTime defines time interval we periodically attempt to reconnect dead links ReconnectTime = 5 * time.Second )
View Source
var ( // DefaultAddress is default tunnel bind address DefaultAddress = ":0" // The shared default token DefaultToken = "go.micro.tunnel" )
View Source
var ( // DefaultDialTimeout is the dial timeout if none is specified DefaultDialTimeout = time.Second * 5 // ErrDialTimeout is returned by a call to Dial where the timeout occurs ErrDialTimeout = errors.New("dial timeout") // ErrDiscoverChan is returned when we failed to receive the "announce" back from a discovery ErrDiscoverChan = errors.New("failed to discover channel") // ErrLinkNotFound is returned when a link is specified at dial time and does not exist ErrLinkNotFound = errors.New("link not found") // ErrLinkDisconnected is returned when a link we attempt to send to is disconnected ErrLinkDisconnected = errors.New("link not connected") // ErrLinkLoppback is returned when attempting to send an outbound message over loopback link ErrLinkLoopback = errors.New("link is loopback") // ErrLinkRemote is returned when attempting to send a loopback message over remote link ErrLinkRemote = errors.New("link is remote") // ErrReadTimeout is a timeout on session.Recv ErrReadTimeout = errors.New("read timeout") // ErrDecryptingData is for when theres a nonce error ErrDecryptingData = errors.New("error decrypting data") )
View Source
var (
ErrLinkConnectTimeout = errors.New("link connect timeout")
)
Functions ¶
Types ¶
type DialOption ¶
type DialOption func(*DialOptions)
func DialLink ¶
func DialLink(id string) DialOption
DialLink specifies the link to pin this connection to. This is not applicable if the multicast option is set.
func DialMode ¶
func DialMode(m Mode) DialOption
Dial multicast sets the multicast option to send only to those mapped
func DialTimeout ¶
func DialTimeout(t time.Duration) DialOption
DialTimeout sets the dial timeout of the connection
func DialWait ¶
func DialWait(b bool) DialOption
DialWait specifies whether to wait for the connection to be accepted before returning the session
type DialOptions ¶
type Link ¶
type Link interface {
// Id returns the link unique Id
Id() string
// Delay is the current load on the link (lower is better)
Delay() int64
// Length returns the roundtrip time as nanoseconds (lower is better)
Length() int64
// Current transfer rate as bits per second (lower is better)
Rate() float64
// Is this a loopback link
Loopback() bool
// State of the link: connected/closed/error
State() string
// honours transport socket
transport.Socket
}
Link represents internal links to the tunnel
type ListenOption ¶
type ListenOption func(*ListenOptions)
func ListenTimeout ¶
func ListenTimeout(t time.Duration) ListenOption
Timeout for reads and writes on the listener session