Documentation ¶
Index ¶
- Constants
- func CheckExists(v2rayPath string) error
- func CheckSystem(goos, goArch string) bool
- func Enable() error
- func GetConfig(configPath string) (*vConfig, error)
- func GetDownloadUrl(goos, goArch, version string) (string, error)
- func GetLastReleaseVersion() (string, error)
- func Install(goos, goArch, version, installTo, sharePath, systemdPath, configPath string) error
- func InstallLastRelease() error
- func IsRunning() (bool, error)
- func SetConfig(configPath string, config *Config) error
- func Start() error
- func Stop() error
- type Config
- type ConfigClient
- type ConfigHeader
Constants ¶
View Source
const ( TransportTypeTcp = iota + 1 TransportTypeWebSocket TransportTypeKcp TransportTypeHttp2 )
View Source
const ( TcpTypeNone = "none" TcpTypeHttp = "http" )
View Source
const CmdPath = "/usr/local/bin/v2ray"
View Source
const ConfigPath = "/usr/local/etc/v2ray/config.json"
View Source
const InstallTo = "/usr/local/bin"
View Source
const SystemdPath = "/etc"
Variables ¶
This section is empty.
Functions ¶
func GetDownloadUrl ¶
GetDownloadUrl 获取版本的下载链接
func GetLastReleaseVersion ¶
GetLastReleaseVersion 获取V2ray最后一个版本的版本号
Types ¶
type Config ¶
type Config struct { Clients []ConfigClient `json:"clients"` V2rayPort int `json:"v2ray_port"` TransportType int `json:"transport_type"` Tcp struct { Type string `json:"type"` Request struct { Version string `json:"version"` Method string `json:"method"` Path string `json:"path"` Headers []ConfigHeader `json:"headers"` } `json:"request"` Response struct { Version string `json:"version"` Status string `json:"status"` Reason string `json:"reason"` Headers []ConfigHeader `json:"headers"` } `json:"response"` } `json:"tcp"` WebSocket struct { Path string `json:"path"` Headers []ConfigHeader `json:"headers"` } `json:"web_socket"` Kcp struct { Type string `json:"type"` Mtu int `json:"mtu"` Tti int `json:"tti"` UpLinkCapacity int `json:"uplink_capacity"` DownLinkCapacity int `json:"downlink_capacity"` Congestion bool `json:"congestion"` ReadBufferSize int `json:"read_buffer_size"` WriteBufferSize int `json:"write_buffer_size"` } `json:"kcp"` Http2 struct { Host string `json:"host"` Path string `json:"path"` } `json:"http2"` UseTls bool TlsHost string TlsKeyFile string TlsCertFile string }
Config 配置结构
type ConfigClient ¶
type ConfigHeader ¶
Click to show internal directories.
Click to hide internal directories.