Documentation
¶
Index ¶
- func Close(proxyURL string)
- func CloseAll()
- func HysteriaToXRay(cfg *HysteriaConfig, port int, protocol string) ([]byte, int, error)
- func ShadowsocksToXRay(su *ShadowsocksURL, port int) ([]byte, int, error)
- func StartHysteria(u *url.URL, port int) (*core.Instance, int, error)
- func StartShadowsocks(u *url.URL, port int) (*core.Instance, int, error)
- func StartTrojan(u *url.URL, port int) (*core.Instance, int, error)
- func StartVless(u *url.URL, port int) (*core.Instance, int, error)
- func StartVmess(u *url.URL, port int) (*core.Instance, int, error)
- func StartWireGuard(u *url.URL, port int) (*core.Instance, int, error)
- func TrojanToXRay(u *url.URL, port int) ([]byte, int, error)
- func VlessToXRay(vu *VlessURL, port int) ([]byte, int, error)
- func VmessToXRay(vmess *VmessConfig, port int) ([]byte, int, error)
- func WireGuardToXRay(wu *WireGuardURL, port int) ([]byte, int, error)
- type DNSConfig
- type FlexInt
- type FlexString
- type GRPCSettings
- type HTTPSettings
- type Header
- type HysteriaConfig
- type HysteriaSettings
- type HysteriaURL
- type Inbound
- type KCPSettings
- type LogConfig
- type Mux
- type Outbound
- type QUICSettings
- type RealitySettings
- type RoutingConfig
- type RoutingRule
- type Server
- type ShadowsocksConfig
- type ShadowsocksURL
- type Sniffing
- type SocksSetting
- type StreamSettings
- type TCPSettings
- type TLSSettings
- type TrojanConfig
- type TrojanURL
- type VlessConfig
- type VlessURL
- type VmessConfig
- type VmessURL
- type WSSettings
- type WireGuardConfig
- type WireGuardURL
- type XHTTPSettings
- type XRayConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HysteriaToXRay ¶
func ShadowsocksToXRay ¶
func ShadowsocksToXRay(su *ShadowsocksURL, port int) ([]byte, int, error)
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
func VmessToXRay ¶
func VmessToXRay(vmess *VmessConfig, port int) ([]byte, int, error)
VmessToXRay converts VMess URL to Xray JSON configuration
func WireGuardToXRay ¶
func WireGuardToXRay(wu *WireGuardURL, port int) ([]byte, int, error)
Types ¶
type FlexString ¶
type FlexString string
func (*FlexString) UnmarshalJSON ¶
func (s *FlexString) UnmarshalJSON(data []byte) error
func (FlexString) Value ¶
func (s FlexString) Value() string
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 HysteriaConfig ¶
type HysteriaConfig struct {
Scheme string
Address string
Port int
Password string
Auth string
HopPorts string
UseUDPExtension bool
Protocol string
UpMbps int
DownMbps int
Congestion string
Obfs string
ObfsPassword string
SNI string
ALPN []string
Fingerprint string
AllowInsecure bool
PinnedPeerCertSha256 string
VerifyPeerCertByName string
Remark string
// contains filtered or unexported fields
}
HysteriaConfig stores Hysteria/Hysteria2 URL parameters. Supported schemes: hysteria://, hysteria2://, hy2://
type HysteriaSettings ¶
type HysteriaSettings struct {
Version int32 `json:"version,omitempty"`
Auth string `json:"auth,omitempty"`
Up string `json:"up,omitempty"`
Down string `json:"down,omitempty"`
Congestion string `json:"congestion,omitempty"`
ReadIdleTimeout uint64 `json:"read_idle_timeout,omitempty"`
Heartbeat uint64 `json:"health_check_timeout,omitempty"`
DisableMTUDiscovery bool `json:"disable_mtu_discovery,omitempty"`
Obfs string `json:"obfs,omitempty"`
Password string `json:"password,omitempty"`
}
type HysteriaURL ¶
type HysteriaURL struct {
Config *HysteriaConfig
}
func ParseHysteriaURL ¶
func ParseHysteriaURL(u *url.URL) (*HysteriaURL, error)
func (*HysteriaURL) PortString ¶
func (h *HysteriaURL) PortString() string
func (*HysteriaURL) String ¶
func (h *HysteriaURL) String() string
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 ShadowsocksConfig ¶
type ShadowsocksConfig struct {
Method string
Password string
Address string
Port int
UoT bool
Remark string
// contains filtered or unexported fields
}
ShadowsocksConfig stores ss:// URL parameters.
type ShadowsocksURL ¶
type ShadowsocksURL struct {
Config *ShadowsocksConfig
}
func ParseShadowsocksURL ¶
func ParseShadowsocksURL(u *url.URL) (*ShadowsocksURL, error)
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
HysteriaSettings *HysteriaSettings `json:"hysteriaSettings,omitempty"`
}
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
PublicKey string
ShortID string
SpiderX string
ServiceName string
AllowInsecure bool
PinnedPeerCertSha256 string
VerifyPeerCertByName string
Remark string
// contains filtered or unexported fields
}
TrojanConfig stores Trojan URL parameters trojan://password@host:port?security=tls&type=tcp&sni=example.com...
type TrojanURL ¶
type TrojanURL struct {
Config *TrojanConfig
}
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
PinnedPeerCertSha256 string
VerifyPeerCertByName string
Remark string
// contains filtered or unexported fields
}
VlessConfig stores VLESS URL parameters
type VlessURL ¶
type VlessURL struct {
Config *VlessConfig
}
type VmessConfig ¶
type VmessConfig struct {
V FlexInt `json:"v"`
PS string `json:"ps"` // Remarks
Add string `json:"add"` // Address
Port FlexInt `json:"port"` // Port
ID string `json:"id"` // UUID
Aid FlexInt `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 FlexString `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
PinnedPeerCertSha256 string `json:"pcs"` // SHA-256 pin for the peer certificate
VerifyPeerCertByName string `json:"vcn"` // Certificate name accepted by Xray
// contains filtered or unexported fields
}
VmessConfig stores VMess URL parameters
type VmessURL ¶
type VmessURL struct {
Config *VmessConfig
}
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 WireGuardConfig ¶
type WireGuardConfig struct {
SecretKey string
PublicKey string
Endpoint string
Address []string
AllowedIPs []string
Reserved []int
KeepAlive int
MTU int
Workers int
DomainStrategy string
Remark string
// contains filtered or unexported fields
}
WireGuardConfig stores WireGuard URL parameters. Example: wireguard://secretKey@host:port?publicKey=xxx&address=10.0.0.2/32&allowedIPs=0.0.0.0/0,::/0
type WireGuardURL ¶
type WireGuardURL struct {
Config *WireGuardConfig
}
func ParseWireGuardURL ¶
func ParseWireGuardURL(u *url.URL) (*WireGuardURL, error)
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