internet

package
v1.8.24 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: MPL-2.0 Imports: 29 Imported by: 224

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",
		5: "DomainSocket",
		6: "HTTPUpgrade",
		7: "SplitHTTP",
	}
	TransportProtocol_value = map[string]int32{
		"TCP":          0,
		"UDP":          1,
		"MKCP":         2,
		"WebSocket":    3,
		"HTTP":         4,
		"DomainSocket": 5,
		"HTTPUpgrade":  6,
		"SplitHTTP":    7,
	}
)

Enum value maps for TransportProtocol.

View Source
var (
	DomainStrategy_name = map[int32]string{
		0:  "AS_IS",
		1:  "USE_IP",
		2:  "USE_IP4",
		3:  "USE_IP6",
		4:  "USE_IP46",
		5:  "USE_IP64",
		6:  "FORCE_IP",
		7:  "FORCE_IP4",
		8:  "FORCE_IP6",
		9:  "FORCE_IP46",
		10: "FORCE_IP64",
	}
	DomainStrategy_value = map[string]int32{
		"AS_IS":      0,
		"USE_IP":     1,
		"USE_IP4":    2,
		"USE_IP6":    3,
		"USE_IP46":   4,
		"USE_IP64":   5,
		"FORCE_IP":   6,
		"FORCE_IP4":  7,
		"FORCE_IP6":  8,
		"FORCE_IP46": 9,
		"FORCE_IP64": 10,
	}
)

Enum value maps for DomainStrategy.

View Source
var (
	SocketConfig_TProxyMode_name = map[int32]string{
		0: "Off",
		1: "TProxy",
		2: "Redirect",
	}
	SocketConfig_TProxyMode_value = map[string]int32{
		"Off":      0,
		"TProxy":   1,
		"Redirect": 2,
	}
)

Enum value maps for SocketConfig_TProxyMode.

View Source
var File_transport_internet_config_proto protoreflect.FileDescriptor

Functions

func ApplyGlobalTransportSettings

func ApplyGlobalTransportSettings(settings []*TransportConfig) error

func CreateTransportConfig

func CreateTransportConfig(name string) (interface{}, error)

Note: Each new transport needs to add init() func in transport/internet/xxx/config.go Otherwise, it will cause #3244

func DestIpAddress added in v1.8.7

func DestIpAddress() net.IP

DestIpAddress returns the ip of proxy server. It is useful in case of Android client, which prepare an IP before proxy connection is established

func Dial

func Dial(ctx context.Context, dest net.Destination, streamSettings *MemoryStreamConfig) (stat.Connection, error)

Dial dials a internet connection towards the given destination.

func DialSystem

func DialSystem(ctx context.Context, dest net.Destination, sockopt *SocketConfig) (net.Conn, error)

DialSystem calls system dialer to create a network connection.

func InitSystemDialer added in v1.4.0

func InitSystemDialer(dc dns.Client, om outbound.Manager)

func IsValidHTTPHost added in v1.8.17

func IsValidHTTPHost(request string, config string) bool

func ListenSystem

func ListenSystem(ctx context.Context, addr net.Addr, sockopt *SocketConfig) (net.Listener, error)

ListenSystem listens on a local address for incoming TCP connections.

xray:api:beta

func ListenSystemPacket

func ListenSystemPacket(ctx context.Context, addr net.Addr, sockopt *SocketConfig) (net.PacketConn, error)

ListenSystemPacket listens on a local address for incoming UDP connections.

xray:api:beta

func RegisterDialerController

func RegisterDialerController(ctl control.Func) error

RegisterDialerController adds a controller to the effective system dialer. The controller can be used to operate on file descriptors before they are put into use. It only works when effective dialer is the default dialer.

xray:api:beta

func RegisterListenerController

func RegisterListenerController(controller control.Func) error

RegisterListenerController adds a controller to the effective system listener. The controller can be used to operate on file descriptors before they are put into use.

xray:api:beta

func RegisterProtocolConfigCreator

func RegisterProtocolConfigCreator(name string, creator ConfigCreator) error

func RegisterTransportDialer

func RegisterTransportDialer(protocol string, dialer dialFunc) error

RegisterTransportDialer registers a Dialer with given name.

func RegisterTransportListener

func RegisterTransportListener(protocol string, listener ListenFunc) error

func UseAlternativeSystemDialer

func UseAlternativeSystemDialer(dialer SystemDialer)

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

xray:api:stable

Types

type ConfigCreator

type ConfigCreator func() interface{}

type ConnHandler

type ConnHandler func(stat.Connection)

type ConnectionAuthenticator

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

func CreateConnectionAuthenticator

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

type CustomSockopt added in v1.8.17

type CustomSockopt struct {
	Level string `protobuf:"bytes,1,opt,name=level,proto3" json:"level,omitempty"`
	Opt   string `protobuf:"bytes,2,opt,name=opt,proto3" json:"opt,omitempty"`
	Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
	Type  string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*CustomSockopt) Descriptor deprecated added in v1.8.17

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

Deprecated: Use CustomSockopt.ProtoReflect.Descriptor instead.

func (*CustomSockopt) GetLevel added in v1.8.17

func (x *CustomSockopt) GetLevel() string

func (*CustomSockopt) GetOpt added in v1.8.17

func (x *CustomSockopt) GetOpt() string

func (*CustomSockopt) GetType added in v1.8.17

func (x *CustomSockopt) GetType() string

func (*CustomSockopt) GetValue added in v1.8.17

func (x *CustomSockopt) GetValue() string

func (*CustomSockopt) ProtoMessage added in v1.8.17

func (*CustomSockopt) ProtoMessage()

func (*CustomSockopt) ProtoReflect added in v1.8.17

func (x *CustomSockopt) ProtoReflect() protoreflect.Message

func (*CustomSockopt) Reset added in v1.8.17

func (x *CustomSockopt) Reset()

func (*CustomSockopt) String added in v1.8.17

func (x *CustomSockopt) String() string

type DefaultListener

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

func (*DefaultListener) Listen

func (dl *DefaultListener) Listen(ctx context.Context, addr net.Addr, sockopt *SocketConfig) (l net.Listener, err error)

func (*DefaultListener) ListenPacket

func (dl *DefaultListener) ListenPacket(ctx context.Context, addr net.Addr, sockopt *SocketConfig) (net.PacketConn, error)

type DefaultSystemDialer

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

func (*DefaultSystemDialer) DestIpAddress added in v1.8.7

func (d *DefaultSystemDialer) DestIpAddress() net.IP

func (*DefaultSystemDialer) Dial

func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest net.Destination, sockopt *SocketConfig) (net.Conn, error)

type Dialer

type Dialer interface {
	// Dial dials a system connection to the given destination.
	Dial(ctx context.Context, destination net.Destination) (stat.Connection, error)

	// Address returns the address used by this Dialer. Maybe nil if not known.
	Address() net.Address

	// DestIpAddress returns the ip of proxy server. It is useful in case of Android client, which prepare an IP before proxy connection is established
	DestIpAddress() net.IP
}

Dialer is the interface for dialing outbound connections.

type DomainStrategy added in v1.4.0

type DomainStrategy int32
const (
	DomainStrategy_AS_IS      DomainStrategy = 0
	DomainStrategy_USE_IP     DomainStrategy = 1
	DomainStrategy_USE_IP4    DomainStrategy = 2
	DomainStrategy_USE_IP6    DomainStrategy = 3
	DomainStrategy_USE_IP46   DomainStrategy = 4
	DomainStrategy_USE_IP64   DomainStrategy = 5
	DomainStrategy_FORCE_IP   DomainStrategy = 6
	DomainStrategy_FORCE_IP4  DomainStrategy = 7
	DomainStrategy_FORCE_IP6  DomainStrategy = 8
	DomainStrategy_FORCE_IP46 DomainStrategy = 9
	DomainStrategy_FORCE_IP64 DomainStrategy = 10
)

func (DomainStrategy) Descriptor added in v1.4.0

func (DomainStrategy) Enum added in v1.4.0

func (x DomainStrategy) Enum() *DomainStrategy

func (DomainStrategy) EnumDescriptor deprecated added in v1.4.0

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

Deprecated: Use DomainStrategy.Descriptor instead.

func (DomainStrategy) Number added in v1.4.0

func (DomainStrategy) String added in v1.4.0

func (x DomainStrategy) String() string

func (DomainStrategy) Type added in v1.4.0

type FakePacketConn added in v1.8.24

type FakePacketConn struct {
	net.Conn
}

func (*FakePacketConn) LocalAddr added in v1.8.24

func (c *FakePacketConn) LocalAddr() net.Addr

func (*FakePacketConn) ReadFrom added in v1.8.24

func (c *FakePacketConn) ReadFrom(p []byte) (n int, addr net.Addr, err error)

func (*FakePacketConn) SetReadBuffer added in v1.8.24

func (c *FakePacketConn) SetReadBuffer(bytes int) error

func (*FakePacketConn) WriteTo added in v1.8.24

func (c *FakePacketConn) WriteTo(p []byte, _ net.Addr) (n int, err error)

type FileLocker

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

FileLocker is UDS access lock

func (*FileLocker) Acquire

func (fl *FileLocker) Acquire() error

Acquire lock

func (*FileLocker) Release

func (fl *FileLocker) Release()

Release lock

type ListenFunc

type ListenFunc func(ctx context.Context, address net.Address, port net.Port, settings *MemoryStreamConfig, 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, settings *MemoryStreamConfig, handler ConnHandler) (Listener, error)

func ListenUnix

func ListenUnix(ctx context.Context, address net.Address, settings *MemoryStreamConfig, handler ConnHandler) (Listener, error)

ListenUnix is the UDS version of ListenTCP

type MemoryStreamConfig

type MemoryStreamConfig struct {
	ProtocolName     string
	ProtocolSettings interface{}
	SecurityType     string
	SecuritySettings interface{}
	SocketSettings   *SocketConfig
}

MemoryStreamConfig is a parsed form of StreamConfig. This is used to reduce the number of Protobuf parsings.

func ToMemoryStreamConfig

func ToMemoryStreamConfig(s *StreamConfig) (*MemoryStreamConfig, error)

ToMemoryStreamConfig converts a StreamConfig to MemoryStreamConfig. It returns a default non-nil MemoryStreamConfig for nil input.

type PacketConnWrapper added in v1.1.5

type PacketConnWrapper struct {
	Conn net.PacketConn
	Dest net.Addr
}

func (*PacketConnWrapper) Close added in v1.1.5

func (c *PacketConnWrapper) Close() error

func (*PacketConnWrapper) LocalAddr added in v1.1.5

func (c *PacketConnWrapper) LocalAddr() net.Addr

func (*PacketConnWrapper) Read added in v1.1.5

func (c *PacketConnWrapper) Read(p []byte) (int, error)

func (*PacketConnWrapper) ReadFrom added in v1.1.5

func (c *PacketConnWrapper) ReadFrom(p []byte) (int, net.Addr, error)

func (*PacketConnWrapper) RemoteAddr added in v1.1.5

func (c *PacketConnWrapper) RemoteAddr() net.Addr

func (*PacketConnWrapper) SetDeadline added in v1.1.5

func (c *PacketConnWrapper) SetDeadline(t time.Time) error

func (*PacketConnWrapper) SetReadDeadline added in v1.1.5

func (c *PacketConnWrapper) SetReadDeadline(t time.Time) error

func (*PacketConnWrapper) SetWriteDeadline added in v1.1.5

func (c *PacketConnWrapper) SetWriteDeadline(t time.Time) error

func (*PacketConnWrapper) Write added in v1.1.5

func (c *PacketConnWrapper) Write(p []byte) (int, error)

func (*PacketConnWrapper) WriteTo added in v1.1.5

func (c *PacketConnWrapper) WriteTo(p []byte, d net.Addr) (int, error)

type PacketHeader

type PacketHeader interface {
	Size() int32
	Serialize([]byte)
}

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"`
	TransportLayerProxy bool   `protobuf:"varint,2,opt,name=transportLayerProxy,proto3" json:"transportLayerProxy,omitempty"`
	// contains filtered or unexported fields
}

func (*ProxyConfig) Descriptor deprecated

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

Deprecated: Use ProxyConfig.ProtoReflect.Descriptor instead.

func (*ProxyConfig) GetTag

func (x *ProxyConfig) GetTag() string

func (*ProxyConfig) GetTransportLayerProxy added in v1.4.0

func (x *ProxyConfig) GetTransportLayerProxy() bool

func (*ProxyConfig) HasTag

func (c *ProxyConfig) HasTag() bool

func (*ProxyConfig) ProtoMessage

func (*ProxyConfig) ProtoMessage()

func (*ProxyConfig) ProtoReflect

func (x *ProxyConfig) ProtoReflect() protoreflect.Message

func (*ProxyConfig) Reset

func (x *ProxyConfig) Reset()

func (*ProxyConfig) String

func (x *ProxyConfig) String() string

type SimpleSystemDialer

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

func (*SimpleSystemDialer) DestIpAddress added in v1.8.7

func (d *SimpleSystemDialer) DestIpAddress() net.IP

func (*SimpleSystemDialer) Dial

func (v *SimpleSystemDialer) Dial(ctx context.Context, src net.Address, dest net.Destination, sockopt *SocketConfig) (net.Conn, error)

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 int32 `protobuf:"varint,2,opt,name=tfo,proto3" json:"tfo,omitempty"`
	// TProxy is for enabling TProxy socket option.
	Tproxy SocketConfig_TProxyMode `protobuf:"varint,3,opt,name=tproxy,proto3,enum=xray.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 */
	BindAddress                []byte           `protobuf:"bytes,5,opt,name=bind_address,json=bindAddress,proto3" json:"bind_address,omitempty"`
	BindPort                   uint32           `protobuf:"varint,6,opt,name=bind_port,json=bindPort,proto3" json:"bind_port,omitempty"`
	AcceptProxyProtocol        bool             `protobuf:"varint,7,opt,name=accept_proxy_protocol,json=acceptProxyProtocol,proto3" json:"accept_proxy_protocol,omitempty"`
	DomainStrategy             DomainStrategy   `` /* 148-byte string literal not displayed */
	DialerProxy                string           `protobuf:"bytes,9,opt,name=dialer_proxy,json=dialerProxy,proto3" json:"dialer_proxy,omitempty"`
	TcpKeepAliveInterval       int32            `` /* 127-byte string literal not displayed */
	TcpKeepAliveIdle           int32            `protobuf:"varint,11,opt,name=tcp_keep_alive_idle,json=tcpKeepAliveIdle,proto3" json:"tcp_keep_alive_idle,omitempty"`
	TcpCongestion              string           `protobuf:"bytes,12,opt,name=tcp_congestion,json=tcpCongestion,proto3" json:"tcp_congestion,omitempty"`
	Interface                  string           `protobuf:"bytes,13,opt,name=interface,proto3" json:"interface,omitempty"`
	V6Only                     bool             `protobuf:"varint,14,opt,name=v6only,proto3" json:"v6only,omitempty"`
	TcpWindowClamp             int32            `protobuf:"varint,15,opt,name=tcp_window_clamp,json=tcpWindowClamp,proto3" json:"tcp_window_clamp,omitempty"`
	TcpUserTimeout             int32            `protobuf:"varint,16,opt,name=tcp_user_timeout,json=tcpUserTimeout,proto3" json:"tcp_user_timeout,omitempty"`
	TcpMaxSeg                  int32            `protobuf:"varint,17,opt,name=tcp_max_seg,json=tcpMaxSeg,proto3" json:"tcp_max_seg,omitempty"`
	TcpNoDelay                 bool             `protobuf:"varint,18,opt,name=tcp_no_delay,json=tcpNoDelay,proto3" json:"tcp_no_delay,omitempty"`
	TcpMptcp                   bool             `protobuf:"varint,19,opt,name=tcp_mptcp,json=tcpMptcp,proto3" json:"tcp_mptcp,omitempty"`
	CustomSockopt              []*CustomSockopt `protobuf:"bytes,20,rep,name=customSockopt,proto3" json:"customSockopt,omitempty"`
	// contains filtered or unexported fields
}

SocketConfig is options to be applied on network sockets.

func (*SocketConfig) Descriptor deprecated

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

Deprecated: Use SocketConfig.ProtoReflect.Descriptor instead.

func (*SocketConfig) GetAcceptProxyProtocol

func (x *SocketConfig) GetAcceptProxyProtocol() bool

func (*SocketConfig) GetBindAddress

func (x *SocketConfig) GetBindAddress() []byte

func (*SocketConfig) GetBindPort

func (x *SocketConfig) GetBindPort() uint32

func (*SocketConfig) GetCustomSockopt added in v1.8.17

func (x *SocketConfig) GetCustomSockopt() []*CustomSockopt

func (*SocketConfig) GetDialerProxy added in v1.4.0

func (x *SocketConfig) GetDialerProxy() string

func (*SocketConfig) GetDomainStrategy added in v1.4.0

func (x *SocketConfig) GetDomainStrategy() DomainStrategy

func (*SocketConfig) GetInterface added in v1.7.3

func (x *SocketConfig) GetInterface() string

func (*SocketConfig) GetMark

func (x *SocketConfig) GetMark() int32

func (*SocketConfig) GetReceiveOriginalDestAddress

func (x *SocketConfig) GetReceiveOriginalDestAddress() bool

func (*SocketConfig) GetTcpCongestion added in v1.6.1

func (x *SocketConfig) GetTcpCongestion() string

func (*SocketConfig) GetTcpKeepAliveIdle added in v1.5.10

func (x *SocketConfig) GetTcpKeepAliveIdle() int32

func (*SocketConfig) GetTcpKeepAliveInterval added in v1.5.0

func (x *SocketConfig) GetTcpKeepAliveInterval() int32

func (*SocketConfig) GetTcpMaxSeg added in v1.8.2

func (x *SocketConfig) GetTcpMaxSeg() int32

func (*SocketConfig) GetTcpMptcp added in v1.8.5

func (x *SocketConfig) GetTcpMptcp() bool

func (*SocketConfig) GetTcpNoDelay added in v1.8.2

func (x *SocketConfig) GetTcpNoDelay() bool

func (*SocketConfig) GetTcpUserTimeout added in v1.8.2

func (x *SocketConfig) GetTcpUserTimeout() int32

func (*SocketConfig) GetTcpWindowClamp added in v1.8.0

func (x *SocketConfig) GetTcpWindowClamp() int32

func (*SocketConfig) GetTfo

func (x *SocketConfig) GetTfo() int32

func (*SocketConfig) GetTproxy

func (x *SocketConfig) GetTproxy() SocketConfig_TProxyMode

func (*SocketConfig) GetV6Only added in v1.8.0

func (x *SocketConfig) GetV6Only() bool

func (*SocketConfig) ParseTFOValue added in v1.4.1

func (v *SocketConfig) ParseTFOValue() int

func (*SocketConfig) ProtoMessage

func (*SocketConfig) ProtoMessage()

func (*SocketConfig) ProtoReflect

func (x *SocketConfig) ProtoReflect() protoreflect.Message

func (*SocketConfig) Reset

func (x *SocketConfig) Reset()

func (*SocketConfig) String

func (x *SocketConfig) 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) Descriptor

func (SocketConfig_TProxyMode) Enum

func (SocketConfig_TProxyMode) EnumDescriptor deprecated

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

Deprecated: Use SocketConfig_TProxyMode.Descriptor instead.

func (SocketConfig_TProxyMode) IsEnabled

func (m SocketConfig_TProxyMode) IsEnabled() bool

func (SocketConfig_TProxyMode) Number

func (SocketConfig_TProxyMode) String

func (x SocketConfig_TProxyMode) String() string

func (SocketConfig_TProxyMode) Type

type StreamConfig

type StreamConfig struct {

	// Effective network. Deprecated. Use the string form below.
	//
	// Deprecated: Marked as deprecated in transport/internet/config.proto.
	Protocol TransportProtocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=xray.transport.internet.TransportProtocol" json:"protocol,omitempty"`
	// 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"`
	// contains filtered or unexported fields
}

func (*StreamConfig) Descriptor deprecated

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

Deprecated: Use StreamConfig.ProtoReflect.Descriptor instead.

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 (x *StreamConfig) GetProtocol() TransportProtocol

Deprecated: Marked as deprecated in transport/internet/config.proto.

func (*StreamConfig) GetProtocolName

func (x *StreamConfig) GetProtocolName() string

func (*StreamConfig) GetSecuritySettings

func (x *StreamConfig) GetSecuritySettings() []*serial.TypedMessage

func (*StreamConfig) GetSecurityType

func (x *StreamConfig) GetSecurityType() string

func (*StreamConfig) GetSocketSettings

func (x *StreamConfig) GetSocketSettings() *SocketConfig

func (*StreamConfig) GetTransportSettings

func (x *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) ProtoReflect

func (x *StreamConfig) ProtoReflect() protoreflect.Message

func (*StreamConfig) Reset

func (x *StreamConfig) Reset()

func (*StreamConfig) String

func (x *StreamConfig) String() string

type SystemDialer

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

func WithAdapter

func WithAdapter(dialer SystemDialerAdapter) SystemDialer

type SystemDialerAdapter

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

type TransportConfig

type TransportConfig struct {

	// Type of network that this settings supports.
	// Deprecated. Use the string form below.
	//
	// Deprecated: Marked as deprecated in transport/internet/config.proto.
	Protocol TransportProtocol `protobuf:"varint,1,opt,name=protocol,proto3,enum=xray.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"`
	// contains filtered or unexported fields
}

func (*TransportConfig) Descriptor deprecated

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

Deprecated: Use TransportConfig.ProtoReflect.Descriptor instead.

func (*TransportConfig) GetProtocol deprecated

func (x *TransportConfig) GetProtocol() TransportProtocol

Deprecated: Marked as deprecated in transport/internet/config.proto.

func (*TransportConfig) GetProtocolName

func (x *TransportConfig) GetProtocolName() string

func (*TransportConfig) GetSettings

func (x *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) ProtoReflect

func (x *TransportConfig) ProtoReflect() protoreflect.Message

func (*TransportConfig) Reset

func (x *TransportConfig) Reset()

func (*TransportConfig) String

func (x *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
	TransportProtocol_DomainSocket TransportProtocol = 5
	TransportProtocol_HTTPUpgrade  TransportProtocol = 6
	TransportProtocol_SplitHTTP    TransportProtocol = 7
)

func (TransportProtocol) Descriptor

func (TransportProtocol) Enum

func (TransportProtocol) EnumDescriptor deprecated

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

Deprecated: Use TransportProtocol.Descriptor instead.

func (TransportProtocol) Number

func (TransportProtocol) String

func (x TransportProtocol) String() string

func (TransportProtocol) Type

Directories

Path Synopsis
headers
dns
tls
utp
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

Jump to

Keyboard shortcuts

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