internet

package
v3.11.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2018 License: MIT Imports: 10 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TransportProtocol_name = map[int32]string{
	0: "TCP",
	1: "UDP",
	2: "MKCP",
	3: "WebSocket",
	4: "HTTP",
}
View Source
var TransportProtocol_value = map[string]int32{
	"TCP":       0,
	"UDP":       1,
	"MKCP":      2,
	"WebSocket": 3,
	"HTTP":      4,
}

Functions

func ApplyGlobalTransportSettings

func ApplyGlobalTransportSettings(settings []*TransportConfig) error

func ContextWithDialerSource

func ContextWithDialerSource(ctx context.Context, addr net.Address) context.Context

func ContextWithSecuritySettings

func ContextWithSecuritySettings(ctx context.Context, securitySettings interface{}) context.Context

func ContextWithStreamSettings

func ContextWithStreamSettings(ctx context.Context, streamSettings *StreamConfig) context.Context

func ContextWithTransportSettings

func ContextWithTransportSettings(ctx context.Context, transportSettings interface{}) context.Context

func CreateTransportConfig

func CreateTransportConfig(protocol TransportProtocol) (interface{}, error)

func DialSystem

func DialSystem(ctx context.Context, src net.Address, dest net.Destination) (net.Conn, error)

DialSystem calls system dialer to create a network connection.

func DialerSourceFromContext

func DialerSourceFromContext(ctx context.Context) net.Address

func RegisterProtocolConfigCreator

func RegisterProtocolConfigCreator(protocol TransportProtocol, creator ConfigCreator) error

func RegisterTransportDialer

func RegisterTransportDialer(protocol TransportProtocol, dialer Dialer) error

func RegisterTransportListener

func RegisterTransportListener(protocol TransportProtocol, listener ListenFunc) error

func SecuritySettingsFromContext

func SecuritySettingsFromContext(ctx context.Context) interface{}

func TransportSettingsFromContext

func TransportSettingsFromContext(ctx context.Context) interface{}

func UseAlternativeSystemDialer added in v1.21.2

func UseAlternativeSystemDialer(dialer SystemDialer)

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

Types

type ConfigCreator

type ConfigCreator func() interface{}

type ConnHandler

type ConnHandler func(Connection)

type Connection

type Connection interface {
	net.Conn
}

func Dial

func Dial(ctx context.Context, dest net.Destination) (Connection, error)

type ConnectionAuthenticator

type ConnectionAuthenticator interface {
	Client(net.Conn) net.Conn
	Server(net.Conn) net.Conn
}

func CreateConnectionAuthenticator

func CreateConnectionAuthenticator(config interface{}) (ConnectionAuthenticator, error)

type DefaultSystemDialer added in v1.21.2

type DefaultSystemDialer struct {
}

func (DefaultSystemDialer) Dial added in v1.21.2

type Dialer

type Dialer func(ctx context.Context, dest net.Destination) (Connection, error)

type ListenFunc

type ListenFunc func(ctx context.Context, address net.Address, port net.Port, handler ConnHandler) (Listener, error)

type Listener

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

func ListenTCP

func ListenTCP(ctx context.Context, address net.Address, port net.Port, handler ConnHandler) (Listener, error)

type PacketHeader

type PacketHeader interface {
	Size() int
	Write([]byte) (int, error)
}

func CreatePacketHeader

func CreatePacketHeader(config interface{}) (PacketHeader, error)

type ProxyConfig

type ProxyConfig struct {
	Tag string `protobuf:"bytes,1,opt,name=tag" json:"tag,omitempty"`
}

func (*ProxyConfig) Descriptor

func (*ProxyConfig) Descriptor() ([]byte, []int)

func (*ProxyConfig) GetTag

func (m *ProxyConfig) GetTag() string

func (*ProxyConfig) HasTag

func (c *ProxyConfig) HasTag() bool

func (*ProxyConfig) ProtoMessage

func (*ProxyConfig) ProtoMessage()

func (*ProxyConfig) Reset

func (m *ProxyConfig) Reset()

func (*ProxyConfig) String

func (m *ProxyConfig) String() string

type SimpleSystemDialer added in v1.21.2

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

func (*SimpleSystemDialer) Dial added in v1.21.2

type StreamConfig

type StreamConfig struct {
	// Effective network.
	Protocol          TransportProtocol  `protobuf:"varint,1,opt,name=protocol,enum=v2ray.core.transport.internet.TransportProtocol" json:"protocol,omitempty"`
	TransportSettings []*TransportConfig `protobuf:"bytes,2,rep,name=transport_settings,json=transportSettings" json:"transport_settings,omitempty"`
	// Type of security. Must be a message name of the settings proto.
	SecurityType string `protobuf:"bytes,3,opt,name=security_type,json=securityType" json:"security_type,omitempty"`
	// Settings for transport security. For now the only choice is TLS.
	SecuritySettings []*v2ray_core_common_serial.TypedMessage `protobuf:"bytes,4,rep,name=security_settings,json=securitySettings" json:"security_settings,omitempty"`
}

func StreamSettingsFromContext

func StreamSettingsFromContext(ctx context.Context) *StreamConfig

func (*StreamConfig) Descriptor

func (*StreamConfig) Descriptor() ([]byte, []int)

func (*StreamConfig) GetEffectiveProtocol

func (c *StreamConfig) GetEffectiveProtocol() TransportProtocol

func (*StreamConfig) GetEffectiveSecuritySettings

func (c *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error)

func (*StreamConfig) GetEffectiveTransportSettings

func (c *StreamConfig) GetEffectiveTransportSettings() (interface{}, error)

func (*StreamConfig) GetProtocol

func (m *StreamConfig) GetProtocol() TransportProtocol

func (*StreamConfig) GetSecuritySettings

func (m *StreamConfig) GetSecuritySettings() []*v2ray_core_common_serial.TypedMessage

func (*StreamConfig) GetSecurityType

func (m *StreamConfig) GetSecurityType() string

func (*StreamConfig) GetTransportSettings

func (m *StreamConfig) GetTransportSettings() []*TransportConfig

func (*StreamConfig) GetTransportSettingsFor

func (c *StreamConfig) GetTransportSettingsFor(protocol TransportProtocol) (interface{}, error)

func (*StreamConfig) HasSecuritySettings

func (c *StreamConfig) HasSecuritySettings() bool

func (*StreamConfig) ProtoMessage

func (*StreamConfig) ProtoMessage()

func (*StreamConfig) Reset

func (m *StreamConfig) Reset()

func (*StreamConfig) String

func (m *StreamConfig) String() string

type SystemDialer added in v1.21.2

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

func WithAdapter added in v1.21.2

func WithAdapter(dialer SystemDialerAdapter) SystemDialer

type SystemDialerAdapter added in v1.21.2

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

type TransportConfig

type TransportConfig struct {
	// Type of network that this settings supports.
	Protocol TransportProtocol `protobuf:"varint,1,opt,name=protocol,enum=v2ray.core.transport.internet.TransportProtocol" json:"protocol,omitempty"`
	// Specific settings. Must be of the transports.
	Settings *v2ray_core_common_serial.TypedMessage `protobuf:"bytes,2,opt,name=settings" json:"settings,omitempty"`
}

func (*TransportConfig) Descriptor

func (*TransportConfig) Descriptor() ([]byte, []int)

func (*TransportConfig) GetProtocol

func (m *TransportConfig) GetProtocol() TransportProtocol

func (*TransportConfig) GetSettings

func (*TransportConfig) GetTypedSettings

func (c *TransportConfig) GetTypedSettings() (interface{}, error)

func (*TransportConfig) ProtoMessage

func (*TransportConfig) ProtoMessage()

func (*TransportConfig) Reset

func (m *TransportConfig) Reset()

func (*TransportConfig) String

func (m *TransportConfig) String() string

type TransportProtocol

type TransportProtocol int32
const (
	TransportProtocol_TCP       TransportProtocol = 0
	TransportProtocol_UDP       TransportProtocol = 1
	TransportProtocol_MKCP      TransportProtocol = 2
	TransportProtocol_WebSocket TransportProtocol = 3
	TransportProtocol_HTTP      TransportProtocol = 4
)

func (TransportProtocol) EnumDescriptor

func (TransportProtocol) EnumDescriptor() ([]byte, []int)

func (TransportProtocol) String

func (x TransportProtocol) String() string

Directories

Path Synopsis
headers
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
Package websocket implements Websocket transport Websocket transport implements a HTTP(S) compliable, surveillance proof transport method with plausible deniability.
Package websocket implements Websocket transport Websocket transport implements a HTTP(S) compliable, surveillance proof transport method with plausible deniability.

Jump to

Keyboard shortcuts

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