tunl

package
v0.1.32 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: AGPL-3.0 Imports: 10 Imported by: 7

Documentation

Index

Constants

View Source
const (
	ErrorServerFull int32 = 2000 + iota
	ErrorUnauthorized
	ErrorSessionExpired
	ErrorClientResponse
	ErrorServerRequest
)
View Source
const ReaderSize = 1 << 20

Variables

View Source
var ErrorConnectionClosed = errors.New("connection closed")

Functions

This section is empty.

Types

type AddrType

type AddrType byte
const (
	IP AddrType = iota
	PORT
	URL
	DIR
)

type Address

type Address struct {
	// contains filtered or unexported fields
}

func NewAddress

func NewAddress(a string) (*Address, error)

func (Address) ToProtoString

func (a Address) ToProtoString() string

func (Address) ToString

func (a Address) ToString() string

func (Address) Type

func (a Address) Type() AddrType

type CommandCallback

type CommandCallback func(cmd *commands.Transfer)

type DisconnectCallback

type DisconnectCallback func()

type ErrorCallback

type ErrorCallback func(err error)

type TunlConn

type TunlConn struct {
	ID   string
	Conn net.Conn

	ExpireAt    time.Time
	ConnectedAt time.Time

	IsClosed bool
	// contains filtered or unexported fields
}

func NewTunlConn

func NewTunlConn(conn net.Conn) *TunlConn

func (*TunlConn) Close

func (t *TunlConn) Close() error

func (*TunlConn) HandleConnection

func (t *TunlConn) HandleConnection()

func (*TunlConn) HandleExpire

func (t *TunlConn) HandleExpire()

func (*TunlConn) Read

func (t *TunlConn) Read() ([]byte, error)

func (*TunlConn) Send

func (t *TunlConn) Send(m proto.Message) (n int, err error)

func (*TunlConn) SetExpireAt

func (t *TunlConn) SetExpireAt(e time.Time)

func (*TunlConn) SetOnCommand

func (t *TunlConn) SetOnCommand(c CommandCallback)

func (*TunlConn) SetOnDisconnected

func (t *TunlConn) SetOnDisconnected(c DisconnectCallback)

func (*TunlConn) SetOnError

func (t *TunlConn) SetOnError(c ErrorCallback)

func (*TunlConn) Write

func (t *TunlConn) Write(data []byte) (n int, err error)

Jump to

Keyboard shortcuts

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