Documentation ¶
Index ¶
- Constants
- func BatchRenderTestDownload(link string, concurrency int, fontPath string, pngPath string, language string, ...) error
- func BatchTestDownload(link string, concurrency int, testDownload TestDownload) error
- func BatchTestLatency(link string, concurrency int, testLatency TestLatency)
- func BatchTestVmessCoreLatency(link string, concurrency int, testLatency TestLatency)
- func CheckVersion() string
- func CheckXVersion() string
- func CopyAssets(assetDir string, force bool) error
- func DecodeJSONConfig(reader io.Reader) (*conf.Config, error)
- func GenerateVmessString(profile *Vmess) (string, error)
- func GetFreePort() (int, error)
- func InputPacket(data []byte)
- func ParseClash(message string) (string, error)
- func PeekClash(message string, n int) (string, error)
- func QueryOutboundStats(tag string, direct string) int64
- func QueryOutboundXStats(tag string, direct string) int64
- func QueryStats(direct string) int64
- func Resolve(addr string, enableIPv6 bool, hostname string) (string, error)
- func SetLocalDNS(dns string)
- func SetNonblock(fd int, nonblocking bool) bool
- func StartShadowsocksTunFd(tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, ...) error
- func StartTrojan(packetFlow PacketFlow, vpnService VpnService, logService LogService, ...) error
- func StartTrojanTunFd(tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, ...) error
- func StartV2Ray(packetFlow PacketFlow, vpnService VpnService, logService LogService, ...) error
- func StartV2RayLiteWithTunFd(tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, ...) error
- func StartV2RayWithTunFd(tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, ...) error
- func StartV2RayWithVmess(packetFlow PacketFlow, vpnService VpnService, logService LogService, ...) error
- func StartXRay(packetFlow PacketFlow, vpnService VpnService, logService LogService, ...) error
- func StartXRayWithTunFd(tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, ...) error
- func StartXShadowsocksTunFd(tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, ...) error
- func StartXTrojanTunFd(tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, ...) error
- func StartXVlessTunFd(tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, ...) error
- func StopV2Ray()
- func TestConfig(ConfigureFileContent string, assetperfix string) error
- func TestConfigLatency(configBytes []byte, assetPath string) (int64, error)
- func TestLinkDownloadSpeed(link string, cb TestLatencyStop) (int64, error)
- func TestTCPPing(host string, port int) (int64, error)
- func TestTrojanLatency(trojan *Trojan) (int64, error)
- func TestURLLatency(url string) (int64, error)
- func TestVmessDownload(profile *Vmess, timeout time.Duration, cb TestLatency) (int64, error)
- func TestVmessLatency(profile *Vmess, port int) (int64, error)
- func TestVmessLatencyDirect(profile *Vmess) (int64, error)
- type LogService
- type PacketFlow
- type QuerySpeed
- type Shadowsocks
- type TestDownload
- type TestLatency
- type TestLatencyStop
- type Trojan
- type Vless
- type Vmess
- type VmessOptions
- type VpnService
Constants ¶
const ( Version5 = 0x05 AuthMethodNotRequired = 0x00 SocksCmdConnect = 0x01 AddrTypeIPv4 = 0x01 AddrTypeFQDN = 0x03 AddrTypeIPv6 = 0x04 StatusSucceeded = 0x00 )
Variables ¶
This section is empty.
Functions ¶
func BatchRenderTestDownload ¶ added in v0.9.0
func BatchTestDownload ¶ added in v0.9.0
func BatchTestDownload(link string, concurrency int, testDownload TestDownload) error
func BatchTestLatency ¶ added in v0.9.0
func BatchTestLatency(link string, concurrency int, testLatency TestLatency)
func BatchTestVmessCoreLatency ¶ added in v0.9.0
func BatchTestVmessCoreLatency(link string, concurrency int, testLatency TestLatency)
FIXME: block on startup
func CheckVersion ¶
func CheckVersion() string
func CheckXVersion ¶ added in v0.9.0
func CheckXVersion() string
func GenerateVmessString ¶
func GetFreePort ¶
func InputPacket ¶
func InputPacket(data []byte)
Write IP packets to the lwIP stack. Call this function in the main loop of the VpnService in Java/Kotlin, which should reads packets from the TUN fd.
func ParseClash ¶ added in v0.9.0
convert clash file to vmess/trojan links, links are separated by newline(\n)
func QueryOutboundStats ¶ added in v0.8.0
add in v2ray-core v4.26.0
func QueryOutboundXStats ¶ added in v0.9.0
func QueryStats ¶
~/go/src/github.com/v2fly/v2ray-core/v4/proxy/vmess/outbound/outbound.go
func SetLocalDNS ¶
func SetLocalDNS(dns string)
SetLocalDNS sets the DNS server that used by Go's default resolver, it accepts string in the form "host:port", e.g. 223.5.5.5:53
func SetNonblock ¶
SetNonblock puts the fd in blocking or non-blocking mode.
func StartShadowsocksTunFd ¶ added in v0.9.0
func StartShadowsocksTunFd( tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, shadowsocks *Shadowsocks, assetPath string) error
func StartTrojan ¶ added in v0.8.0
func StartTrojan( packetFlow PacketFlow, vpnService VpnService, logService LogService, trojan *Trojan, assetPath string) error
func StartTrojanTunFd ¶ added in v0.8.0
func StartTrojanTunFd( tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, trojan *Trojan, assetPath string) error
func StartV2Ray ¶
func StartV2Ray( packetFlow PacketFlow, vpnService VpnService, logService LogService, querySpeed QuerySpeed, configBytes []byte, assetPath string) error
StartV2Ray sets up lwIP stack, starts a V2Ray instance and registers the instance as the connection handler for tun2socks.
func StartV2RayLiteWithTunFd ¶ added in v0.9.0
func StartV2RayLiteWithTunFd( tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, profile *Vmess, assetPath string) error
func StartV2RayWithTunFd ¶ added in v0.8.0
func StartV2RayWithTunFd( tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, profile *Vmess, assetPath string) error
func StartV2RayWithVmess ¶
func StartV2RayWithVmess( packetFlow PacketFlow, vpnService VpnService, logService LogService, profile *Vmess, assetPath string) error
StartV2Ray sets up lwIP stack, starts a V2Ray instance and registers the instance as the connection handler for tun2socks.
func StartXRay ¶ added in v0.9.0
func StartXRay( packetFlow PacketFlow, vpnService VpnService, logService LogService, querySpeed QuerySpeed, configBytes []byte, assetPath string) error
func StartXRayWithTunFd ¶ added in v0.9.0
func StartXRayWithTunFd( tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, profile *Vmess, assetPath string) error
func StartXShadowsocksTunFd ¶ added in v0.9.0
func StartXShadowsocksTunFd( tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, shadowsocks *Shadowsocks, assetPath string) error
func StartXTrojanTunFd ¶ added in v0.9.0
func StartXTrojanTunFd( tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, trojan *Trojan, assetPath string) error
func StartXVlessTunFd ¶ added in v0.9.0
func StartXVlessTunFd( tunFd int, vpnService VpnService, logService LogService, querySpeed QuerySpeed, vl *Vless, assetPath string) error
func TestConfig ¶
func TestConfigLatency ¶
func TestLinkDownloadSpeed ¶ added in v0.9.0
func TestLinkDownloadSpeed(link string, cb TestLatencyStop) (int64, error)
func TestTrojanLatency ¶ added in v0.8.0
func TestURLLatency ¶
func TestVmessDownload ¶ added in v0.9.0
func TestVmessLatencyDirect ¶ added in v0.9.0
TODO: support more protocol
Types ¶
type LogService ¶
type PacketFlow ¶
type PacketFlow interface { // WritePacket should writes packets to the TUN fd. WritePacket(packet []byte) }
PacketFlow should be implemented in Java/Kotlin.
type QuerySpeed ¶ added in v0.8.0
type Shadowsocks ¶ added in v0.9.0
type Shadowsocks features.Shadowsocks
func NewShadowSocks ¶ added in v0.9.0
type TestDownload ¶ added in v0.9.0
type TestLatency ¶ added in v0.9.0
type TestLatencyStop ¶ added in v0.9.0
type VmessOptions ¶ added in v0.8.0
type VmessOptions features.VmessOptions
type VpnService ¶
type VpnService interface { // Protect is just a proxy to the VpnService.protect() method. // See also: https://developer.android.com/reference/android/net/VpnService.html#protect(int) Protect(fd int) bool }
VpnService should be implemented in Java/Kotlin.