internet

package
v1.24.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2016 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicatedAuthenticator = errors.New("Authenticator already registered.")
	ErrAuthenticatorNotFound   = errors.New("Authenticator not found.")
)
View Source
var (
	ErrUnsupportedStreamType = errors.New("Unsupported stream type.")
)

Functions

func DialToDest

func DialToDest(src v2net.Address, dest v2net.Destination) (net.Conn, error)

func RegisterAuthenticator

func RegisterAuthenticator(name string, factory AuthenticatorFactory, configCreator loader.ConfigCreator) error

func SubstituteDialer

func SubstituteDialer(dialer SystemDialerAdapter) error

SubstituteDialer replaces the current system dialer with a given one. Caller must ensure there is no race condition. @Deprecated: Use UseAlternativeSimpleSystemDialer.

func UseAlternativeSystemDialer

func UseAlternativeSystemDialer(dialer SystemDialer)

UseAlternativeSystemDialer replaces the current system dialer with a given one. Caller must ensure there is no race condition.

Types

type Authenticator

type Authenticator interface {
	Seal(*alloc.Buffer)
	Open(*alloc.Buffer) bool
	Overhead() int
}

func CreateAuthenticator

func CreateAuthenticator(name string, config AuthenticatorConfig) (Authenticator, error)

func NewAuthenticatorChain

func NewAuthenticatorChain(auths ...Authenticator) Authenticator

type AuthenticatorChain

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

func (*AuthenticatorChain) Open

func (this *AuthenticatorChain) Open(payload *alloc.Buffer) bool

func (*AuthenticatorChain) Overhead

func (this *AuthenticatorChain) Overhead() int

func (*AuthenticatorChain) Seal

func (this *AuthenticatorChain) Seal(payload *alloc.Buffer)

type AuthenticatorConfig

type AuthenticatorConfig interface {
}

func CreateAuthenticatorConfig

func CreateAuthenticatorConfig(rawConfig []byte) (string, AuthenticatorConfig, error)

type AuthenticatorFactory

type AuthenticatorFactory interface {
	Create(AuthenticatorConfig) Authenticator
}

type Connection

type Connection interface {
	net.Conn
	Reusable
}

func Dial

func Dial(src v2net.Address, dest v2net.Destination, settings *StreamSettings) (Connection, error)

type ConnectionHandler

type ConnectionHandler func(Connection)

type DefaultSystemDialer

type DefaultSystemDialer struct {
}

func (*DefaultSystemDialer) Dial

func (this *DefaultSystemDialer) Dial(src v2net.Address, dest v2net.Destination) (net.Conn, error)

type Dialer

type Dialer func(src v2net.Address, dest v2net.Destination) (Connection, error)
var (
	TCPDialer    Dialer
	KCPDialer    Dialer
	RawTCPDialer Dialer
	UDPDialer    Dialer
)

type ListenFunc

type ListenFunc func(address v2net.Address, port v2net.Port) (Listener, error)
var (
	ErrClosedConnection = errors.New("Connection already closed.")

	KCPListenFunc    ListenFunc
	TCPListenFunc    ListenFunc
	RawTCPListenFunc ListenFunc
)

type Listener

type Listener interface {
	Accept() (Connection, error)
	Close() error
	Addr() net.Addr
}

type Reusable

type Reusable interface {
	Reusable() bool
	SetReusable(reuse bool)
}

type SimpleSystemDialer

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

func (*SimpleSystemDialer) Dial

func (this *SimpleSystemDialer) Dial(src v2net.Address, dest v2net.Destination) (net.Conn, error)

type StreamConnectionType

type StreamConnectionType int
const (
	StreamConnectionTypeRawTCP StreamConnectionType = 1
	StreamConnectionTypeTCP    StreamConnectionType = 2
	StreamConnectionTypeKCP    StreamConnectionType = 4
)

type StreamSecurityType

type StreamSecurityType int
const (
	StreamSecurityTypeNone StreamSecurityType = 0
	StreamSecurityTypeTLS  StreamSecurityType = 1
)

type StreamSettings

type StreamSettings struct {
	Type        StreamConnectionType
	Security    StreamSecurityType
	TLSSettings *TLSSettings
}

func (*StreamSettings) IsCapableOf

func (this *StreamSettings) IsCapableOf(streamType StreamConnectionType) bool

type SysFd

type SysFd interface {
	SysFd() (int, error)
}

type SystemDialer

type SystemDialer interface {
	Dial(source v2net.Address, destination v2net.Destination) (net.Conn, error)
}

func WithAdapter

func WithAdapter(dialer SystemDialerAdapter) SystemDialer

type SystemDialerAdapter

type SystemDialerAdapter interface {
	Dial(network string, address string) (net.Conn, error)
}

type TCPHub

type TCPHub struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func ListenTCP

func ListenTCP(address v2net.Address, port v2net.Port, callback ConnectionHandler, settings *StreamSettings) (*TCPHub, error)

func (*TCPHub) Close

func (this *TCPHub) Close()

type TLSSettings

type TLSSettings struct {
	AllowInsecure bool
	Certs         []tls.Certificate
}

func (*TLSSettings) GetTLSConfig

func (this *TLSSettings) GetTLSConfig() *tls.Config

Directories

Path Synopsis
authenticators
utp
Package kcp - A Fast and Reliable ARQ Protocol Acknowledgement: skywind3000@github for inventing the KCP protocol xtaci@github for translating to Golang
Package kcp - A Fast and Reliable ARQ Protocol Acknowledgement: skywind3000@github for inventing the KCP protocol xtaci@github for translating to Golang

Jump to

Keyboard shortcuts

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