Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyGlobalTransportSettings(settings []*TransportConfig) error
- func BindAddressFromContext(ctx context.Context) net.Destination
- func ContextWithBindAddress(ctx context.Context, dest net.Destination) context.Context
- func ContextWithStreamSettings(ctx context.Context, streamSettings *MemoryStreamConfig) context.Context
- func CreateTransportConfig(protocol TransportProtocol) (interface{}, error)
- func CreateTransportConfigByName(name string) (interface{}, error)
- func DialSystem(ctx context.Context, dest net.Destination) (net.Conn, error)
- func ListenSystem(ctx context.Context, addr net.Addr) (net.Listener, error)
- func ListenSystemPacket(ctx context.Context, addr net.Addr) (net.PacketConn, error)
- func RegisterProtocolConfigCreator(protocol TransportProtocol, creator ConfigCreator) error
- func RegisterProtocolConfigCreatorByName(name string, creator ConfigCreator) error
- func RegisterTransportDialer(protocol string, dialer Dialer) error
- func RegisterTransportListener(protocol string, listener ListenFunc) error
- func UseAlternativeSystemDialer(dialer SystemDialer)
- type ConfigCreator
- type ConnHandler
- type Connection
- type ConnectionAuthenticator
- type DefaultListener
- type DefaultSystemDialer
- type Dialer
- type ListenFunc
- type Listener
- type MemoryStreamConfig
- 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 (m *ProxyConfig) XXX_Merge(src proto.Message)
- func (m *ProxyConfig) XXX_Size() int
- func (m *ProxyConfig) XXX_Unmarshal(b []byte) error
- type SimpleSystemDialer
- type SocketConfig
- func (*SocketConfig) Descriptor() ([]byte, []int)
- func (m *SocketConfig) GetMark() int32
- func (m *SocketConfig) GetReceiveOriginalDestAddress() bool
- func (m *SocketConfig) GetTfo() SocketConfig_TCPFastOpenState
- func (m *SocketConfig) GetTproxy() SocketConfig_TProxyMode
- func (*SocketConfig) ProtoMessage()
- func (m *SocketConfig) Reset()
- func (m *SocketConfig) String() string
- func (m *SocketConfig) XXX_DiscardUnknown()
- func (m *SocketConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SocketConfig) XXX_Merge(src proto.Message)
- func (m *SocketConfig) XXX_Size() int
- func (m *SocketConfig) XXX_Unmarshal(b []byte) error
- type SocketConfig_TCPFastOpenState
- type SocketConfig_TProxyMode
- type StatCouterConnection
- type StreamConfig
- func (*StreamConfig) Descriptor() ([]byte, []int)
- func (c *StreamConfig) GetEffectiveProtocol() string
- func (c *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error)
- func (c *StreamConfig) GetEffectiveTransportSettings() (interface{}, error)
- func (m *StreamConfig) GetProtocol() TransportProtocoldeprecated
- func (m *StreamConfig) GetProtocolName() string
- func (m *StreamConfig) GetSecuritySettings() []*serial.TypedMessage
- func (m *StreamConfig) GetSecurityType() string
- func (m *StreamConfig) GetSocketSettings() *SocketConfig
- func (m *StreamConfig) GetTransportSettings() []*TransportConfig
- func (c *StreamConfig) GetTransportSettingsFor(protocol string) (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 (m *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) GetProtocolName() string
- func (m *TransportConfig) GetSettings() *serial.TypedMessage
- func (c *TransportConfig) GetTypedSettings() (interface{}, error)
- func (c *TransportConfig) GetUnifiedProtocolName() string
- 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 (m *TransportConfig) XXX_Merge(src proto.Message)
- func (m *TransportConfig) XXX_Size() int
- func (m *TransportConfig) XXX_Unmarshal(b []byte) error
- type TransportProtocol
Constants ¶
View Source
const ( // For incoming connections. TCP_FASTOPEN = 23 // For out-going connections. TCP_FASTOPEN_CONNECT = 30 )
Variables ¶
View Source
var SocketConfig_TCPFastOpenState_name = map[int32]string{
0: "AsIs",
1: "Enable",
2: "Disable",
}
View Source
var SocketConfig_TCPFastOpenState_value = map[string]int32{
"AsIs": 0,
"Enable": 1,
"Disable": 2,
}
View Source
var SocketConfig_TProxyMode_name = map[int32]string{
0: "Off",
1: "TProxy",
2: "Redirect",
}
View Source
var SocketConfig_TProxyMode_value = map[string]int32{
"Off": 0,
"TProxy": 1,
"Redirect": 2,
}
View Source
var TransportProtocol_name = map[int32]string{
0: "TCP",
1: "UDP",
2: "MKCP",
3: "WebSocket",
4: "HTTP",
5: "DomainSocket",
}
View Source
var TransportProtocol_value = map[string]int32{
"TCP": 0,
"UDP": 1,
"MKCP": 2,
"WebSocket": 3,
"HTTP": 4,
"DomainSocket": 5,
}
Functions ¶
func ApplyGlobalTransportSettings ¶
func ApplyGlobalTransportSettings(settings []*TransportConfig) error
func BindAddressFromContext ¶
func BindAddressFromContext(ctx context.Context) net.Destination
func ContextWithBindAddress ¶
func ContextWithStreamSettings ¶
func ContextWithStreamSettings(ctx context.Context, streamSettings *MemoryStreamConfig) context.Context
func CreateTransportConfig ¶
func CreateTransportConfig(protocol TransportProtocol) (interface{}, error)
func DialSystem ¶
DialSystem calls system dialer to create a network connection.
func ListenSystemPacket ¶
func RegisterProtocolConfigCreator ¶
func RegisterProtocolConfigCreator(protocol TransportProtocol, creator ConfigCreator) error
func RegisterProtocolConfigCreatorByName ¶
func RegisterProtocolConfigCreatorByName(name string, creator ConfigCreator) error
func RegisterTransportDialer ¶
func RegisterTransportListener ¶
func RegisterTransportListener(protocol string, listener ListenFunc) error
func UseAlternativeSystemDialer ¶ added in v1.24.3
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 DefaultListener ¶
type DefaultListener struct{}
func (*DefaultListener) ListenPacket ¶
func (*DefaultListener) ListenPacket(ctx context.Context, addr net.Addr) (net.PacketConn, error)
type DefaultSystemDialer ¶ added in v1.24.3
type DefaultSystemDialer struct { }
type Dialer ¶
type Dialer func(ctx context.Context, dest net.Destination) (Connection, error)
type ListenFunc ¶
type MemoryStreamConfig ¶
type MemoryStreamConfig struct { ProtocolName string ProtocolSettings interface{} SecurityType string SecuritySettings interface{} SocketSettings *SocketConfig }
func StreamSettingsFromContext ¶
func StreamSettingsFromContext(ctx context.Context) *MemoryStreamConfig
func ToMemoryStreamConfig ¶
func ToMemoryStreamConfig(s *StreamConfig) (*MemoryStreamConfig, error)
type PacketHeader ¶
func CreatePacketHeader ¶
func CreatePacketHeader(config interface{}) (PacketHeader, error)
type ProxyConfig ¶
type ProxyConfig struct { Tag string `protobuf:"bytes,1,opt,name=tag,proto3" 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 (m *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.24.3
type SimpleSystemDialer struct {
// contains filtered or unexported fields
}
type SocketConfig ¶
type SocketConfig struct { // Mark of the connection. If non-zero, the value will be set to SO_MARK. Mark int32 `protobuf:"varint,1,opt,name=mark,proto3" json:"mark,omitempty"` // TFO is the state of TFO settings. Tfo SocketConfig_TCPFastOpenState `protobuf:"varint,2,opt,name=tfo,proto3,enum=v2ray.core.transport.internet.SocketConfig_TCPFastOpenState" json:"tfo,omitempty"` // TProxy is for enabling TProxy socket option. Tproxy SocketConfig_TProxyMode `protobuf:"varint,3,opt,name=tproxy,proto3,enum=v2ray.core.transport.internet.SocketConfig_TProxyMode" json:"tproxy,omitempty"` // ReceiveOriginalDestAddress is for enabling IP_RECVORIGDSTADDR socket option. // This option is for UDP only. ReceiveOriginalDestAddress bool `` /* 144-byte string literal not displayed */ XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
SocketConfig is options to be applied on network sockets.
func (*SocketConfig) Descriptor ¶
func (*SocketConfig) Descriptor() ([]byte, []int)
func (*SocketConfig) GetMark ¶
func (m *SocketConfig) GetMark() int32
func (*SocketConfig) GetReceiveOriginalDestAddress ¶
func (m *SocketConfig) GetReceiveOriginalDestAddress() bool
func (*SocketConfig) GetTfo ¶
func (m *SocketConfig) GetTfo() SocketConfig_TCPFastOpenState
func (*SocketConfig) GetTproxy ¶
func (m *SocketConfig) GetTproxy() SocketConfig_TProxyMode
func (*SocketConfig) ProtoMessage ¶
func (*SocketConfig) ProtoMessage()
func (*SocketConfig) Reset ¶
func (m *SocketConfig) Reset()
func (*SocketConfig) String ¶
func (m *SocketConfig) String() string
func (*SocketConfig) XXX_DiscardUnknown ¶
func (m *SocketConfig) XXX_DiscardUnknown()
func (*SocketConfig) XXX_Marshal ¶
func (m *SocketConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SocketConfig) XXX_Merge ¶
func (m *SocketConfig) XXX_Merge(src proto.Message)
func (*SocketConfig) XXX_Size ¶
func (m *SocketConfig) XXX_Size() int
func (*SocketConfig) XXX_Unmarshal ¶
func (m *SocketConfig) XXX_Unmarshal(b []byte) error
type SocketConfig_TCPFastOpenState ¶
type SocketConfig_TCPFastOpenState int32
const ( // AsIs is to leave the current TFO state as is, unmodified. SocketConfig_AsIs SocketConfig_TCPFastOpenState = 0 // Enable is for enabling TFO explictly. SocketConfig_Enable SocketConfig_TCPFastOpenState = 1 // Disable is for disabling TFO explictly. SocketConfig_Disable SocketConfig_TCPFastOpenState = 2 )
func (SocketConfig_TCPFastOpenState) EnumDescriptor ¶
func (SocketConfig_TCPFastOpenState) EnumDescriptor() ([]byte, []int)
func (SocketConfig_TCPFastOpenState) String ¶
func (x SocketConfig_TCPFastOpenState) String() string
type SocketConfig_TProxyMode ¶
type SocketConfig_TProxyMode int32
const ( // TProxy is off. SocketConfig_Off SocketConfig_TProxyMode = 0 // TProxy mode. SocketConfig_TProxy SocketConfig_TProxyMode = 1 // Redirect mode. SocketConfig_Redirect SocketConfig_TProxyMode = 2 )
func (SocketConfig_TProxyMode) EnumDescriptor ¶
func (SocketConfig_TProxyMode) EnumDescriptor() ([]byte, []int)
func (SocketConfig_TProxyMode) IsEnabled ¶
func (m SocketConfig_TProxyMode) IsEnabled() bool
func (SocketConfig_TProxyMode) String ¶
func (x SocketConfig_TProxyMode) String() string
type StatCouterConnection ¶
type StatCouterConnection struct { Connection Uplink addInt64 Downlink addInt64 }
type StreamConfig ¶
type StreamConfig struct { // Effective network. Deprecated. Use the string form below. Protocol TransportProtocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=v2ray.core.transport.internet.TransportProtocol" json:"protocol,omitempty"` // Deprecated: Do not use. // Effective network. ProtocolName string `protobuf:"bytes,5,opt,name=protocol_name,json=protocolName,proto3" json:"protocol_name,omitempty"` TransportSettings []*TransportConfig `protobuf:"bytes,2,rep,name=transport_settings,json=transportSettings,proto3" 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,proto3" 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,proto3" json:"security_settings,omitempty"` SocketSettings *SocketConfig `protobuf:"bytes,6,opt,name=socket_settings,json=socketSettings,proto3" json:"socket_settings,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*StreamConfig) Descriptor ¶
func (*StreamConfig) Descriptor() ([]byte, []int)
func (*StreamConfig) GetEffectiveProtocol ¶
func (c *StreamConfig) GetEffectiveProtocol() string
func (*StreamConfig) GetEffectiveSecuritySettings ¶
func (c *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error)
func (*StreamConfig) GetEffectiveTransportSettings ¶
func (c *StreamConfig) GetEffectiveTransportSettings() (interface{}, error)
func (*StreamConfig) GetProtocol
deprecated
func (m *StreamConfig) GetProtocol() TransportProtocol
Deprecated: Do not use.
func (*StreamConfig) GetProtocolName ¶
func (m *StreamConfig) GetProtocolName() string
func (*StreamConfig) GetSecuritySettings ¶
func (m *StreamConfig) GetSecuritySettings() []*serial.TypedMessage
func (*StreamConfig) GetSecurityType ¶
func (m *StreamConfig) GetSecurityType() string
func (*StreamConfig) GetSocketSettings ¶
func (m *StreamConfig) GetSocketSettings() *SocketConfig
func (*StreamConfig) GetTransportSettings ¶
func (m *StreamConfig) GetTransportSettings() []*TransportConfig
func (*StreamConfig) GetTransportSettingsFor ¶
func (c *StreamConfig) GetTransportSettingsFor(protocol string) (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 (m *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.24.3
type SystemDialer interface {
Dial(ctx context.Context, source net.Address, destination net.Destination) (net.Conn, error)
}
func WithAdapter ¶ added in v1.24.3
func WithAdapter(dialer SystemDialerAdapter) SystemDialer
type SystemDialerAdapter ¶ added in v1.24.3
type TransportConfig ¶
type TransportConfig struct { // Type of network that this settings supports. // Deprecated. Use the string form below. Protocol TransportProtocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=v2ray.core.transport.internet.TransportProtocol" json:"protocol,omitempty"` // Type of network that this settings supports. ProtocolName string `protobuf:"bytes,3,opt,name=protocol_name,json=protocolName,proto3" json:"protocol_name,omitempty"` // Specific settings. Must be of the transports. Settings *serial.TypedMessage `protobuf:"bytes,2,opt,name=settings,proto3" 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) GetProtocolName ¶
func (m *TransportConfig) GetProtocolName() string
func (*TransportConfig) GetSettings ¶
func (m *TransportConfig) GetSettings() *serial.TypedMessage
func (*TransportConfig) GetTypedSettings ¶
func (c *TransportConfig) GetTypedSettings() (interface{}, error)
func (*TransportConfig) GetUnifiedProtocolName ¶
func (c *TransportConfig) GetUnifiedProtocolName() string
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 (m *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.