Documentation ¶
Index ¶
- Variables
- func ApplyGlobalNetworkSettings(settings []*NetworkSettings) error
- func CreateNetworkConfig(network v2net.Network) (interface{}, error)
- func DialSystem(src v2net.Address, dest v2net.Destination) (net.Conn, error)
- func RegisterConnectionAuthenticator(name string, factory ConnectionAuthenticatorFactory) error
- func RegisterNetworkConfigCreator(network v2net.Network, creator ConfigCreator) error
- func RegisterNetworkDialer(network v2net.Network, dialer Dialer) error
- func RegisterNetworkListener(network v2net.Network, listener ListenFunc) error
- func RegisterPacketHeader(name string, factory PacketHeaderFactory) error
- func SubstituteDialer(dialer SystemDialerAdapter) error
- func UseAlternativeSystemDialer(dialer SystemDialer)
- type ConfigCreator
- type Connection
- type ConnectionAuthenticator
- type ConnectionAuthenticatorFactory
- type ConnectionHandler
- type DefaultSystemDialer
- type Dialer
- type DialerOptions
- type ListenFunc
- type ListenOptions
- type Listener
- type NetworkSettings
- func (*NetworkSettings) Descriptor() ([]byte, []int)
- func (m *NetworkSettings) GetNetwork() v2ray_core_common_net.Network
- func (m *NetworkSettings) GetSettings() *v2ray_core_common_serial.TypedMessage
- func (v *NetworkSettings) GetTypedSettings() (interface{}, error)
- func (*NetworkSettings) ProtoMessage()
- func (m *NetworkSettings) Reset()
- func (m *NetworkSettings) String() string
- type PacketHeader
- type PacketHeaderFactory
- type ProxyConfig
- type Reusable
- type SimpleSystemDialer
- type StreamConfig
- func (*StreamConfig) Descriptor() ([]byte, []int)
- func (v *StreamConfig) GetEffectiveNetworkSettings() (interface{}, error)
- func (v *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error)
- func (m *StreamConfig) GetNetwork() v2ray_core_common_net.Network
- func (m *StreamConfig) GetNetworkSettings() []*NetworkSettings
- func (m *StreamConfig) GetSecuritySettings() []*v2ray_core_common_serial.TypedMessage
- func (m *StreamConfig) GetSecurityType() string
- 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
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrClosedConnection = errors.New("Connection already closed.")
)
View Source
var (
ErrUnconfiguredNetwork = errors.New("Network config creator not set.")
)
View Source
var (
ErrUnsupportedStreamType = errors.New("Unsupported stream type.")
)
Functions ¶
func ApplyGlobalNetworkSettings ¶
func ApplyGlobalNetworkSettings(settings []*NetworkSettings) error
func CreateNetworkConfig ¶
func DialSystem ¶
DialSystem calls system dialer to create a network connection.
func RegisterConnectionAuthenticator ¶
func RegisterConnectionAuthenticator(name string, factory ConnectionAuthenticatorFactory) error
func RegisterNetworkConfigCreator ¶
func RegisterNetworkConfigCreator(network v2net.Network, creator ConfigCreator) error
func RegisterNetworkListener ¶
func RegisterNetworkListener(network v2net.Network, listener ListenFunc) error
func RegisterPacketHeader ¶
func RegisterPacketHeader(name string, factory PacketHeaderFactory) 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(name string, config interface{}) (ConnectionAuthenticator, error)
type ConnectionAuthenticatorFactory ¶
type ConnectionAuthenticatorFactory interface {
Create(interface{}) ConnectionAuthenticator
}
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 NetworkSettings ¶
type NetworkSettings struct { // Type of network that this settings supports. Network v2ray_core_common_net.Network `protobuf:"varint,1,opt,name=network,enum=v2ray.core.common.net.Network" json:"network,omitempty"` // Specific settings. Settings *v2ray_core_common_serial.TypedMessage `protobuf:"bytes,2,opt,name=settings" json:"settings,omitempty"` }
func (*NetworkSettings) Descriptor ¶
func (*NetworkSettings) Descriptor() ([]byte, []int)
func (*NetworkSettings) GetNetwork ¶
func (m *NetworkSettings) GetNetwork() v2ray_core_common_net.Network
func (*NetworkSettings) GetSettings ¶
func (m *NetworkSettings) GetSettings() *v2ray_core_common_serial.TypedMessage
func (*NetworkSettings) GetTypedSettings ¶
func (v *NetworkSettings) GetTypedSettings() (interface{}, error)
func (*NetworkSettings) ProtoMessage ¶
func (*NetworkSettings) ProtoMessage()
func (*NetworkSettings) Reset ¶
func (m *NetworkSettings) Reset()
func (*NetworkSettings) String ¶
func (m *NetworkSettings) String() string
type PacketHeader ¶
func CreatePacketHeader ¶
func CreatePacketHeader(name string, config interface{}) (PacketHeader, error)
type PacketHeaderFactory ¶
type PacketHeaderFactory interface {
Create(interface{}) PacketHeader
}
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. Network v2ray_core_common_net.Network `protobuf:"varint,1,opt,name=network,enum=v2ray.core.common.net.Network" json:"network,omitempty"` NetworkSettings []*NetworkSettings `protobuf:"bytes,2,rep,name=network_settings,json=networkSettings" json:"network_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) GetEffectiveNetworkSettings ¶
func (v *StreamConfig) GetEffectiveNetworkSettings() (interface{}, error)
func (*StreamConfig) GetEffectiveSecuritySettings ¶
func (v *StreamConfig) GetEffectiveSecuritySettings() (interface{}, error)
func (*StreamConfig) GetNetwork ¶
func (m *StreamConfig) GetNetwork() v2ray_core_common_net.Network
func (*StreamConfig) GetNetworkSettings ¶
func (m *StreamConfig) GetNetworkSettings() []*NetworkSettings
func (*StreamConfig) GetSecuritySettings ¶
func (m *StreamConfig) GetSecuritySettings() []*v2ray_core_common_serial.TypedMessage
func (*StreamConfig) GetSecurityType ¶
func (m *StreamConfig) GetSecurityType() string
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
Source Files ¶
Click to show internal directories.
Click to hide internal directories.