link

package
v0.0.0-...-d0fea3d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 4, 2018 License: GPL-3.0 Imports: 11 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLinkShutdown     = errors.New("link is shutdown")
	ErrTimeout          = errors.New("timeout")
	ErrKeepaliveTimeout = errors.New("keepalive error")
	ErrMsgPingInvalid   = errors.New("invalid ping message")
)

Define error

Functions

This section is empty.

Types

type Link struct {
	ID uint32
	// contains filtered or unexported fields
}

Link is the main connection between two endpoint

func NewLink(config *LinkConfig) *Link

NewLink create a new link

func NewLinkCustom

func NewLinkCustom(config *LinkConfig, hdr session.RequestHandler) *Link

NewLinkCustom create a new link by custom session.RequestHandler

func (*Link) Bind

func (l *Link) Bind(conn es.Conn) error

Bind bind link with a underlying connection (tcp)

func (*Link) Close

func (l *Link) Close() error

Close is used to close the link

func (*Link) IsClosed

func (l *Link) IsClosed() bool

IsClosed does a safe check to see if we have shutdown

func (*Link) IsStopped

func (l *Link) IsStopped() bool

IsStopped does a safe check to see if we have shutdown

func (*Link) NewSession

func (l *Link) NewSession() (*session.Session, error)

func (*Link) OpenTunnel

func (l *Link) OpenTunnel(proto string, localHost string, localPort int, remoteHost string, remotePort int, reverse bool) error

OpenTunnel open a tunnel

func (*Link) Ping

func (l *Link) Ping() (time.Duration, error)

Ping is used to measure the RTT response time

func (*Link) Stop

func (l *Link) Stop() error

Stop close the current transaction underlying conn

func (*Link) Wait

func (l *Link) Wait()

type LinkConfig

type LinkConfig struct {
	// ID need to be started differently
	IsServerSide bool

	// KeepaliveInterval is how often to perform the keep alive
	KeepaliveInterval time.Duration

	// ConnectionWriteTimeout is meant to be a "safety valve" timeout after
	// we which will suspect a problem with the underlying connection and
	// close it. This is only applied to writes, where's there's generally
	// an expectation that things will move along quickly.
	ConnectionWriteTimeout time.Duration
}

LinkConfig reserved for config

type OpenTunnelFunc

type OpenTunnelFunc func(proto string, localHost string, localPort int, remoteHost string, remotePort int, reverse bool) error

OpenTunnelFunc define a func about open tunnel

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL