Documentation ¶
Index ¶
- Variables
- func ApplyGlobalTransportSettings(settings []*TransportConfig) error
- func ContextWithDialerSource(ctx context.Context, addr net.Address) context.Context
- func ContextWithSecuritySettings(ctx context.Context, securitySettings interface{}) context.Context
- func ContextWithStreamSettings(ctx context.Context, streamSettings *StreamConfig) context.Context
- func ContextWithTransportSettings(ctx context.Context, transportSettings interface{}) context.Context
- func CreateTransportConfig(protocol TransportProtocol) (interface{}, error)
- func DialSystem(ctx context.Context, src net.Address, dest net.Destination) (net.Conn, error)
- func DialerSourceFromContext(ctx context.Context) net.Address
- func RegisterProtocolConfigCreator(protocol TransportProtocol, creator ConfigCreator) error
- func RegisterTransportDialer(protocol TransportProtocol, dialer Dialer) error
- func RegisterTransportListener(protocol TransportProtocol, listener ListenFunc) error
- func SecuritySettingsFromContext(ctx context.Context) interface{}
- func TransportSettingsFromContext(ctx context.Context) interface{}
- func UseAlternativeSystemDialer(dialer SystemDialer)
- type ConfigCreator
- type ConnHandler
- type Connection
- type ConnectionAuthenticator
- type DefaultSystemDialer
- type Dialer
- type ListenFunc
- type Listener
- type PacketHeader
- type ProxyConfig
- func (*ProxyConfig) Descriptor() ([]byte, []int)
- func (m *ProxyConfig) GetTag() string
- func (c *ProxyConfig) HasTag() bool
- func (*ProxyConfig) ProtoMessage()
- func (m *ProxyConfig) Reset()
- func (m *ProxyConfig) String() string
- func (m *ProxyConfig) XXX_DiscardUnknown()
- func (m *ProxyConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *ProxyConfig) XXX_Merge(src proto.Message)
- func (m *ProxyConfig) XXX_Size() int
- func (m *ProxyConfig) XXX_Unmarshal(b []byte) error
- type SimpleSystemDialer
- type StatCouterConnection
- type StreamConfig
- func (*StreamConfig) Descriptor() ([]byte, []int)
- func (c *StreamConfig) GetEffectiveProtocol() TransportProtocol
- func (c *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error)
- func (c *StreamConfig) GetEffectiveTransportSettings() (interface{}, error)
- func (m *StreamConfig) GetProtocol() TransportProtocol
- func (m *StreamConfig) GetSecuritySettings() []*serial.TypedMessage
- func (m *StreamConfig) GetSecurityType() string
- func (m *StreamConfig) GetTransportSettings() []*TransportConfig
- func (c *StreamConfig) GetTransportSettingsFor(protocol TransportProtocol) (interface{}, error)
- func (c *StreamConfig) HasSecuritySettings() bool
- func (*StreamConfig) ProtoMessage()
- func (m *StreamConfig) Reset()
- func (m *StreamConfig) String() string
- func (m *StreamConfig) XXX_DiscardUnknown()
- func (m *StreamConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *StreamConfig) XXX_Merge(src proto.Message)
- func (m *StreamConfig) XXX_Size() int
- func (m *StreamConfig) XXX_Unmarshal(b []byte) error
- type SystemDialer
- type SystemDialerAdapter
- type TransportConfig
- func (*TransportConfig) Descriptor() ([]byte, []int)
- func (m *TransportConfig) GetProtocol() TransportProtocol
- func (m *TransportConfig) GetSettings() *serial.TypedMessage
- func (c *TransportConfig) GetTypedSettings() (interface{}, error)
- func (*TransportConfig) ProtoMessage()
- func (m *TransportConfig) Reset()
- func (m *TransportConfig) String() string
- func (m *TransportConfig) XXX_DiscardUnknown()
- func (m *TransportConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *TransportConfig) XXX_Merge(src proto.Message)
- func (m *TransportConfig) XXX_Size() int
- func (m *TransportConfig) XXX_Unmarshal(b []byte) error
- type TransportProtocol
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ApplyGlobalTransportSettings ¶
func ApplyGlobalTransportSettings(settings []*TransportConfig) error
func ContextWithDialerSource ¶
func ContextWithSecuritySettings ¶
func ContextWithStreamSettings ¶
func ContextWithStreamSettings(ctx context.Context, streamSettings *StreamConfig) context.Context
func ContextWithTransportSettings ¶
func CreateTransportConfig ¶
func CreateTransportConfig(protocol TransportProtocol) (interface{}, error)
func DialSystem ¶
DialSystem calls system dialer to create a network connection.
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 TransportSettingsFromContext ¶
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 ¶
func Dial ¶
func Dial(ctx context.Context, dest net.Destination) (Connection, error)
Dial dials a internet connection towards the given destination.
type ConnectionAuthenticator ¶
func CreateConnectionAuthenticator ¶
func CreateConnectionAuthenticator(config interface{}) (ConnectionAuthenticator, error)
type DefaultSystemDialer ¶ added in v1.21.2
type DefaultSystemDialer struct { }
type Dialer ¶
type Dialer func(ctx context.Context, dest net.Destination) (Connection, error)
type ListenFunc ¶
type Listener ¶
type PacketHeader ¶
func CreatePacketHeader ¶
func CreatePacketHeader(config interface{}) (PacketHeader, error)
type ProxyConfig ¶
type ProxyConfig struct { Tag string `protobuf:"bytes,1,opt,name=tag" json:"tag,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
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
func (*ProxyConfig) XXX_DiscardUnknown ¶
func (m *ProxyConfig) XXX_DiscardUnknown()
func (*ProxyConfig) XXX_Marshal ¶
func (m *ProxyConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*ProxyConfig) XXX_Merge ¶
func (dst *ProxyConfig) XXX_Merge(src proto.Message)
func (*ProxyConfig) XXX_Size ¶
func (m *ProxyConfig) XXX_Size() int
func (*ProxyConfig) XXX_Unmarshal ¶
func (m *ProxyConfig) XXX_Unmarshal(b []byte) error
type SimpleSystemDialer ¶ added in v1.21.2
type SimpleSystemDialer struct {
// contains filtered or unexported fields
}
type StatCouterConnection ¶
type StatCouterConnection struct { Connection Uplink addInt64 Downlink addInt64 }
func (*StatCouterConnection) Read ¶
func (c *StatCouterConnection) Read(b []byte) (int, error)
func (*StatCouterConnection) Write ¶
func (c *StatCouterConnection) Write(b []byte) (int, error)
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 []*serial.TypedMessage `protobuf:"bytes,4,rep,name=security_settings,json=securitySettings" json:"security_settings,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
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() []*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
func (*StreamConfig) XXX_DiscardUnknown ¶
func (m *StreamConfig) XXX_DiscardUnknown()
func (*StreamConfig) XXX_Marshal ¶
func (m *StreamConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*StreamConfig) XXX_Merge ¶
func (dst *StreamConfig) XXX_Merge(src proto.Message)
func (*StreamConfig) XXX_Size ¶
func (m *StreamConfig) XXX_Size() int
func (*StreamConfig) XXX_Unmarshal ¶
func (m *StreamConfig) XXX_Unmarshal(b []byte) error
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 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 *serial.TypedMessage `protobuf:"bytes,2,opt,name=settings" json:"settings,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*TransportConfig) Descriptor ¶
func (*TransportConfig) Descriptor() ([]byte, []int)
func (*TransportConfig) GetProtocol ¶
func (m *TransportConfig) GetProtocol() TransportProtocol
func (*TransportConfig) GetSettings ¶
func (m *TransportConfig) GetSettings() *serial.TypedMessage
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
func (*TransportConfig) XXX_DiscardUnknown ¶
func (m *TransportConfig) XXX_DiscardUnknown()
func (*TransportConfig) XXX_Marshal ¶
func (m *TransportConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TransportConfig) XXX_Merge ¶
func (dst *TransportConfig) XXX_Merge(src proto.Message)
func (*TransportConfig) XXX_Size ¶
func (m *TransportConfig) XXX_Size() int
func (*TransportConfig) XXX_Unmarshal ¶
func (m *TransportConfig) XXX_Unmarshal(b []byte) error
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 TransportProtocol_DomainSocket TransportProtocol = 5 )
func (TransportProtocol) EnumDescriptor ¶
func (TransportProtocol) EnumDescriptor() ([]byte, []int)
func (TransportProtocol) String ¶
func (x TransportProtocol) String() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
headers
|
|
Package kcp - A Fast and Reliable ARQ Protocol
|
Package kcp - A Fast and Reliable ARQ Protocol |
Package websocket implements Websocket transport
|
Package websocket implements Websocket transport |
Click to show internal directories.
Click to hide internal directories.