Documentation
¶
Index ¶
- func Close(proxyURL string)
- func CloseAll()
- func ProxySSR(u *url.URL, o *proxyclient.Options) (http.RoundTripper, error)
- func ProxyTrojan(u *url.URL, o *proxyclient.Options) (http.RoundTripper, error)
- func ProxyVless(u *url.URL, o *proxyclient.Options) (http.RoundTripper, error)
- func ProxyVmess(u *url.URL, o *proxyclient.Options) (http.RoundTripper, error)
- func SSRToXRay(ssrURL string, port int) ([]byte, int, error)
- func StartSSR(ssrURL string, port int) (*core.Instance, int, error)
- func StartTrojan(trojanURL string, port int) (*core.Instance, int, error)
- func StartVless(vlessURL string, port int) (*core.Instance, int, error)
- func StartVmess(vmessURL string, port int) (*core.Instance, int, error)
- func TrojanToXRay(trojanURL string, port int) ([]byte, int, error)
- func VlessToXRay(vlessURL string, port int) ([]byte, int, error)
- func VmessToXRay(vmessURL string, port int) ([]byte, int, error)
- type DNSConfig
- type GRPCSettings
- type HTTPSettings
- type Header
- type Inbound
- type KCPSettings
- type LogConfig
- type Mux
- type Outbound
- type QUICSettings
- type RealitySettings
- type RoutingConfig
- type RoutingRule
- type SSRConfig
- type Server
- type Sniffing
- type SocksSetting
- type StreamSettings
- type TCPSettings
- type TLSSettings
- type TrojanConfig
- type VlessConfig
- type VmessConfig
- type WSSettings
- type XHTTPSettings
- type XRayConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProxySSR ¶
func ProxySSR(u *url.URL, o *proxyclient.Options) (http.RoundTripper, error)
ProxySSR creates a RoundTripper for SSR proxy
func ProxyTrojan ¶
func ProxyTrojan(u *url.URL, o *proxyclient.Options) (http.RoundTripper, error)
ProxyTrojan creates a RoundTripper for Trojan proxy
func ProxyVless ¶
func ProxyVless(u *url.URL, o *proxyclient.Options) (http.RoundTripper, error)
func ProxyVmess ¶
func ProxyVmess(u *url.URL, o *proxyclient.Options) (http.RoundTripper, error)
func StartTrojan ¶
StartTrojan starts a Trojan client and returns Xray instance and local SOCKS port
func StartVless ¶
StartVless starts a VLESS client and returns Xray instance and local SOCKS port
func StartVmess ¶
StartVmess starts a VMess client
func TrojanToXRay ¶
TrojanToXRay converts Trojan URL to Xray JSON configuration
func VlessToXRay ¶
VlessToXRay converts VLESS URL to Xray JSON configuration
Types ¶
type GRPCSettings ¶
type HTTPSettings ¶
type Header ¶
type Header struct {
Type string `json:"type,omitempty"`
Request interface{} `json:"request,omitempty"`
Response interface{} `json:"response,omitempty"`
}
type KCPSettings ¶
type KCPSettings struct {
MTU int `json:"mtu,omitempty"`
TTI int `json:"tti,omitempty"`
UplinkCapacity int `json:"uplinkCapacity,omitempty"`
DownlinkCapacity int `json:"downlinkCapacity,omitempty"`
Congestion bool `json:"congestion,omitempty"`
ReadBufferSize int `json:"readBufferSize,omitempty"`
WriteBufferSize int `json:"writeBufferSize,omitempty"`
Header *Header `json:"header,omitempty"`
}
type Outbound ¶
type Outbound struct {
Tag string `json:"tag,omitempty"`
Protocol string `json:"protocol"`
Settings interface{} `json:"settings"`
StreamSettings *StreamSettings `json:"streamSettings,omitempty"`
Mux *Mux `json:"mux,omitempty"`
}
type QUICSettings ¶
type RealitySettings ¶
type RoutingConfig ¶
type RoutingConfig struct {
DomainStrategy string `json:"domainStrategy,omitempty"`
Rules []RoutingRule `json:"rules,omitempty"`
}
type RoutingRule ¶
type SSRConfig ¶
type SSRConfig struct {
Server string
Port int
Method string
Password string
Protocol string
ProtocolParam string
Obfs string
ObfsParam string
Name string
}
SSRConfig stores ShadowsocksR URL parameters
type SocksSetting ¶
type StreamSettings ¶
type StreamSettings struct {
Network string `json:"network,omitempty"`
Security string `json:"security,omitempty"`
TLSSettings *TLSSettings `json:"tlsSettings,omitempty"`
TCPSettings *TCPSettings `json:"tcpSettings,omitempty"`
KCPSettings *KCPSettings `json:"kcpSettings,omitempty"`
WSSettings *WSSettings `json:"wsSettings,omitempty"`
HTTPSettings *HTTPSettings `json:"httpSettings,omitempty"`
QUICSettings *QUICSettings `json:"quicSettings,omitempty"`
GRPCSettings *GRPCSettings `json:"grpcSettings,omitempty"`
XTLSSettings *TLSSettings `json:"xtlsSettings,omitempty"` // Added XTLS support
RealitySettings *RealitySettings `json:"realitySettings,omitempty"` // Added Reality support
XHTTPSettings *XHTTPSettings `json:"xhttpSettings,omitempty"` // Added XHTTP support
}
type TCPSettings ¶
type TCPSettings struct {
Header *Header `json:"header,omitempty"`
}
type TLSSettings ¶
type TrojanConfig ¶
type TrojanConfig struct {
Password string
Address string
Port int
Flow string
Type string
Security string
Path string
Host string
SNI string
ALPN string
Fingerprint string
ServiceName string
AllowInsecure bool // Controls whether to allow insecure TLS connections
}
TrojanConfig stores Trojan URL parameters
func ParseTrojan ¶
func ParseTrojan(trojanURL string) (*TrojanConfig, error)
ParseTrojan parses Trojan URL trojan://password@host:port?security=tls&type=tcp&sni=example.com...
type VlessConfig ¶
type VlessConfig struct {
UUID string
Address string
Port int
Encryption string
Flow string
Type string
Security string
Path string
Host string
SNI string
ALPN string
Fingerprint string
PublicKey string
ShortID string
SpiderX string
ServiceName string
AllowInsecure bool // Controls whether to allow insecure TLS connections
}
VlessConfig stores VLESS URL parameters
func ParseVless ¶
func ParseVless(vlessURL string) (*VlessConfig, error)
ParseVless parses VLESS URL vless://uuid@host:port?encryption=none&type=tcp&security=tls&sni=example.com...
type VmessConfig ¶
type VmessConfig struct {
V string `json:"v"`
PS string `json:"ps"` // Remarks
Add string `json:"add"` // Address
Port proxyclient.JsonInt `json:"port"` // Port
ID string `json:"id"` // UUID
Aid proxyclient.JsonInt `json:"aid"` // AlterID
Net string `json:"net"` // Transport protocol
Type string `json:"type"` // Camouflage type
Host string `json:"host"` // Camouflage domain
Path string `json:"path"` // WebSocket path
TLS string `json:"tls"` // TLS
SNI string `json:"sni"` // TLS SNI
Alpn string `json:"alpn"` // ALPN
Flow string `json:"flow"` // XTLS Flow
Fp string `json:"fp"` // Fingerprint
PbK string `json:"pbk"` // PublicKey (Reality)
Sid string `json:"sid"` // ShortID (Reality)
SpX string `json:"spx"` // SpiderX (Reality)
Security string `json:"security"` // Encryption method
XHTTPVer string `json:"xver"` // XHTTP version, "h2" or "h3"
AllowInsecure bool `json:"skip_cert_verify"` // Controls whether to allow insecure TLS connections
}
VmessConfig stores VMess URL parameters
type WSSettings ¶
type WSSettings struct {
Path string `json:"path,omitempty"`
Host string `json:"host,omitempty"` // Added independent Host field
Headers map[string]string `json:"headers,omitempty"`
}
Updated WSSettings structure
type XHTTPSettings ¶
type XHTTPSettings struct {
Host string `json:"host,omitempty"`
Path string `json:"path,omitempty"`
Method string `json:"method,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Version string `json:"version,omitempty"` // "h2" or "h3"
}
Added new XHTTP settings structure
type XRayConfig ¶
type XRayConfig struct {
Log *LogConfig `json:"log,omitempty"`
DNS *DNSConfig `json:"dns,omitempty"`
Routing *RoutingConfig `json:"routing,omitempty"`
Inbounds []Inbound `json:"inbounds"`
Outbounds []Outbound `json:"outbounds"`
}
General configuration structure, matching the Xray configuration format