Documentation ¶
Index ¶
- Variables
- func ApplyGlobalTransportSettings(settings []*TransportConfig) error
- func CreateTransportConfig(protocol TransportProtocol) (interface{}, error)
- func DialSystem(src v2net.Address, dest v2net.Destination) (net.Conn, error)
- func RegisterProtocolConfigCreator(protocol TransportProtocol, creator ConfigCreator) error
- func RegisterTransportDialer(protocol TransportProtocol, dialer Dialer) error
- func RegisterTransportListener(protocol TransportProtocol, listener ListenFunc) error
- func SubstituteDialer(dialer SystemDialerAdapter) error
- func UseAlternativeSystemDialer(dialer SystemDialer)
- type ConfigCreator
- type Connection
- type ConnectionAuthenticator
- type ConnectionHandler
- type DefaultSystemDialer
- type Dialer
- type DialerOptions
- type ListenFunc
- type ListenOptions
- type Listener
- type PacketHeader
- type ProxyConfig
- type Reusable
- type SimpleSystemDialer
- type StreamConfig
- func (*StreamConfig) Descriptor() ([]byte, []int)
- func (v *StreamConfig) GetEffectiveProtocol() TransportProtocol
- func (v *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error)
- func (v *StreamConfig) GetEffectiveTransportSettings() (interface{}, error)
- func (m *StreamConfig) GetProtocol() TransportProtocol
- func (m *StreamConfig) GetSecuritySettings() []*v2ray_core_common_serial.TypedMessage
- func (m *StreamConfig) GetSecurityType() string
- func (m *StreamConfig) GetTransportSettings() []*TransportConfig
- func (v *StreamConfig) HasSecuritySettings() bool
- func (*StreamConfig) ProtoMessage()
- func (m *StreamConfig) Reset()
- func (m *StreamConfig) String() string
- type SysFd
- type SystemDialer
- type SystemDialerAdapter
- type TCPHub
- type TransportConfig
- func (*TransportConfig) Descriptor() ([]byte, []int)
- func (m *TransportConfig) GetProtocol() TransportProtocol
- func (m *TransportConfig) GetSettings() *v2ray_core_common_serial.TypedMessage
- func (v *TransportConfig) GetTypedSettings() (interface{}, error)
- func (*TransportConfig) ProtoMessage()
- func (m *TransportConfig) Reset()
- func (m *TransportConfig) String() string
- type TransportProtocol
Constants ¶
This section is empty.
Variables ¶
View Source
var TransportProtocol_name = map[int32]string{
0: "TCP",
1: "UDP",
2: "MKCP",
3: "WebSocket",
}
View Source
var TransportProtocol_value = map[string]int32{
"TCP": 0,
"UDP": 1,
"MKCP": 2,
"WebSocket": 3,
}
Functions ¶
func ApplyGlobalTransportSettings ¶
func ApplyGlobalTransportSettings(settings []*TransportConfig) error
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 SubstituteDialer ¶ added in v1.21.2
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 ¶ 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 Connection ¶
func Dial ¶
func Dial(src v2net.Address, dest v2net.Destination, options DialerOptions) (Connection, error)
type ConnectionAuthenticator ¶
func CreateConnectionAuthenticator ¶
func CreateConnectionAuthenticator(config interface{}) (ConnectionAuthenticator, error)
type ConnectionHandler ¶
type ConnectionHandler func(Connection)
type DefaultSystemDialer ¶ added in v1.21.2
type DefaultSystemDialer struct { }
func (*DefaultSystemDialer) Dial ¶ added in v1.21.2
func (v *DefaultSystemDialer) Dial(src v2net.Address, dest v2net.Destination) (net.Conn, error)
type Dialer ¶
type Dialer func(src v2net.Address, dest v2net.Destination, options DialerOptions) (Connection, error)
var (
ProxyDialer Dialer
)
type DialerOptions ¶
type DialerOptions struct { Stream *StreamConfig Proxy *ProxyConfig }
type ListenFunc ¶
type ListenOptions ¶
type ListenOptions struct {
Stream *StreamConfig
}
type Listener ¶
type Listener interface { Accept() (Connection, error) Close() error Addr() net.Addr }
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"`
}
func (*ProxyConfig) Descriptor ¶
func (*ProxyConfig) Descriptor() ([]byte, []int)
func (*ProxyConfig) GetTag ¶
func (m *ProxyConfig) GetTag() string
func (*ProxyConfig) HasTag ¶
func (v *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
func (v *SimpleSystemDialer) Dial(src v2net.Address, dest v2net.Destination) (net.Conn, 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"` SecuritySettings []*v2ray_core_common_serial.TypedMessage `protobuf:"bytes,4,rep,name=security_settings,json=securitySettings" json:"security_settings,omitempty"` }
func (*StreamConfig) Descriptor ¶
func (*StreamConfig) Descriptor() ([]byte, []int)
func (*StreamConfig) GetEffectiveProtocol ¶
func (v *StreamConfig) GetEffectiveProtocol() TransportProtocol
func (*StreamConfig) GetEffectiveSecuritySettings ¶
func (v *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error)
func (*StreamConfig) GetEffectiveTransportSettings ¶
func (v *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) HasSecuritySettings ¶
func (v *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(source v2net.Address, destination v2net.Destination) (net.Conn, error)
}
func WithAdapter ¶ added in v1.21.2
func WithAdapter(dialer SystemDialerAdapter) SystemDialer
type SystemDialerAdapter ¶ added in v1.21.2
type TCPHub ¶
func ListenTCP ¶
func ListenTCP(address v2net.Address, port v2net.Port, callback ConnectionHandler, settings *StreamConfig) (*TCPHub, 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. 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 (m *TransportConfig) GetSettings() *v2ray_core_common_serial.TypedMessage
func (*TransportConfig) GetTypedSettings ¶
func (v *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 )
func (TransportProtocol) EnumDescriptor ¶
func (TransportProtocol) EnumDescriptor() ([]byte, []int)
func (TransportProtocol) String ¶
func (x TransportProtocol) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.