proxy

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SSRServer = iota
	SSRPort
	SSRProtocol
	SSRCipher // ssr的method
	SSROBFS
	SSRSuffix
)

Variables

View Source
var (
	SsCiphers  = []string{"rc4-md5", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "bf-cfb", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "salsa20", "chacha20", "chacha20-ietf", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "2022-blake3-chacha12-poly1305", "2022-blake3-chacha8-poly1305"}
	SsrCiphers = []string{"none", "table", "rc4", "rc4-md5", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "bf-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "cast5-cfb", "des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "salsa20", "chacha20", "chacha20-ietf"}
)

Functions

func ClashToString

func ClashToString(proxyList ProxyList) string

func ProxieToClash

func ProxieToClash(node Proxy) map[string]any

func ProxieToSip002 added in v0.0.2

func ProxieToSip002(node Proxy) string

func ProxieToSs added in v0.0.2

func ProxieToSs(node Proxy) map[string]interface{}

func ProxieToSsr added in v0.0.2

func ProxieToSsr(node Proxy) string

func ProxieToSurge added in v0.0.3

func ProxieToSurge(node Proxy) string

func ProxieToTrojan added in v0.0.2

func ProxieToTrojan(node Proxy) string

func ProxieToVmess added in v0.0.2

func ProxieToVmess(node Proxy) string

func SsToString added in v0.0.2

func SsToString(proxyList ProxyList, subType int) string

func SsrToString added in v0.0.2

func SsrToString(proxyList ProxyList) string

func SurgeToString added in v0.0.3

func SurgeToString(proxyList ProxyList) string

func TrojanToString added in v0.0.2

func TrojanToString(proxyList ProxyList) string

func VmessToString added in v0.0.2

func VmessToString(proxyList ProxyList) string

Types

type Proxy

type Proxy struct {
	Country string  `json:"country,omitempty"`  // 自定义
	Speed   float64 `json:"speed,omitempty"`    // 自定义
	IsValid bool    `json:"is-valid,omitempty"` // 自定义

	Type   string `json:"type,omitempty"`
	Group  string `json:"group,omitempty"`  // vmess,ssr,ss,socks5,http,trojan,snell
	Name   string `json:"name,omitempty"`   // vmess[ps],ssr,ss,socks5,http,trojan,snell
	Server string `json:"server,omitempty"` // vmess[add],ssr,ss,socks5,http,trojan,snell
	Port   int    `json:"prot,omitempty"`   // vmess,ssr,ss,socks5,http,trojan,snell

	Username         string `json:"user-name,omitempty"`      // *socks5,*http
	Password         string `json:"password,omitempty"`       // *vmess,*ssr,*ss,*socks5,*http,*trojan,*snell: proxy["psk"]
	EncryptMethod    string `json:"cipher,omitempty"`         // *vmess[默认auto],*ssr[默认dummy],*ss
	Plugin           string `json:"plugin,omitempty"`         // *ss
	PluginOption     string `json:"plugin-opts,omitempty"`    // *ss
	Protocol         string `json:"protocol,omitempty"`       // *ssr
	ProtocolParam    string `json:"protocol-param,omitempty"` // *ssr
	OBFS             string `json:"obfs,omitempty"`           // *ssr,snell: proxy["obfs-opts"]["mode"]
	OBFSParam        string `json:"obfs-param,omitempty"`     // *ssr
	UUID             string `json:"uuid,omitempty"`           // *vmess[id]
	AlterID          int    `json:"alterId,omitempty"`        // *vmess
	TransferProtocol string `json:"network,omitempty"`        // *vmess[net=tcp:置空],*trojan[net=tcp:置空]
	FakeType         string `json:"fake-type,omitempty"`      // vmess[type]
	TLSSecure        bool   `json:"tls,omitempty"`            // *vmess[tls],*http,trojan

	// *snell: proxy["obfs-opts"]["host"]
	// *trojan: proxy["sni"]
	// *trojan[net=ws]: proxy["ws-opts"]["headers"]["Host"]
	// *vmess[net=ws]: proxy["ws-opts"]["Host"]
	// *vmess[net=http]: proxy["http-opts"]["headers"]["Host"]
	// *vmess[net=h2]: proxy["h2-opts"]["host"]
	// *vmess[net=grpc]: proxy["servername"]
	Host string `json:"Host,omitempty"`

	// *trojan/vmess[net=ws]: proxy["ws-opts"]["path"]
	// *vmess[net=http]: proxy["http-opts"]["path"]
	// *vmess[net=h2]: proxy["h2-opts"]["path"]
	// *trojan/vmess[net=grpc]: proxy["grpc-opts"]["grpc-service-name"]
	Path string `json:"path,omitempty"`

	// *vmess[net=ws]: proxy["ws-opts"]["Edge"]
	// *vmess[net=http]: proxy["http-opts"]["headers"]["Edge"]
	Edge string `json:"Edge,omitempty"`

	QUICSecure string `json:"QUICSecure,omitempty"` // vmess[net=quic]
	QUICSecret string `json:"QUICSecret,omitempty"` // vmess[net=quic]

	UDP            bool `json:"udp,omitempty"`              // *vmess,*ssr,*ss,*socks5,*trojan,*snell
	TCPFastOpen    bool `json:"tfo,omitempty"`              // vmess,ssr,ss,socks5,http,trojan,snell
	SkipCertVerify bool `json:"skip-cert-verify,omitempty"` // *vmess,ssr,ss,*socks5,*http,*trojan,snell
	TLS13          bool `json:"tls13,omitempty"`            // vmess,ss,http,trojan

	SnellVersion int    `json:"version,omitempty"`    // *snell
	ServerName   string `json:"servername,omitempty"` // *vmess
}

func ParseProxy

func ParseProxy(proxy string) (Proxy, error)

func (Proxy) Identifier

func (proxy Proxy) Identifier() string

func (Proxy) IsEmpty

func (proxy Proxy) IsEmpty() bool

type ProxyList

type ProxyList []Proxy

func ExplodeClash

func ExplodeClash(clash string) (ProxyList, error)

func (ProxyList) Count

func (pl ProxyList) Count() (int, int, int, int, int, int)

func (ProxyList) Filter

func (pl ProxyList) Filter(proxyTypes string, proxyCountry string, proxyNotCountry string) ProxyList

func (ProxyList) RenameAll

func (pl ProxyList) RenameAll() ProxyList

func (*ProxyList) UniqAppendProxy

func (pl *ProxyList) UniqAppendProxy(newProxy Proxy)

func (*ProxyList) UniqAppendProxys

func (pl *ProxyList) UniqAppendProxys(newProxyList ProxyList)

type Vmess

type Vmess struct {
	Add  string `json:"add"`
	Aid  any    `json:"aid"`
	Host string `json:"host"`
	ID   string `json:"id"`
	Net  string `json:"net"`
	Path string `json:"path"`
	Port any    `json:"port"`
	PS   string `json:"ps"`
	TLS  string `json:"tls"`
	Type string `json:"type"`
	Sni  string `json:"sni"`
	V    any    `json:"v"`
}

Jump to

Keyboard shortcuts

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