Documentation
¶
Index ¶
- Variables
- func GrepAnyTLSLinkFromString(text string) []string
- func GrepSSLinkFromString(text string) []string
- func GrepSSRLinkFromString(text string) []string
- func GrepTrojanLinkFromString(text string) []string
- func GrepVlessLinkFromString(text string) []string
- func GrepVmessLinkFromString(text string) []string
- func IsReality(p Proxy) bool
- func IsTLS(p Proxy) bool
- func ToClashMap(p Proxy) map[string]interface{}
- type AnyTLS
- type Base
- func (b *Base) AddBeforeName(name string)
- func (b *Base) AddToName(name string)
- func (b *Base) BaseInfo() *Base
- func (b *Base) Clone() Base
- func (b *Base) SetCountry(country string)
- func (b *Base) SetIP(ip string)
- func (b *Base) SetName(name string)
- func (b *Base) SetUseable(useable bool)
- func (b *Base) TypeName() string
- type HTTP2Options
- type HTTPOptions
- type Proxy
- type ProxyList
- func (ps ProxyList) Clone() ProxyList
- func (ps ProxyList) Deduplication() ProxyList
- func (ps ProxyList) Derive() ProxyList
- func (ps *ProxyList) Find(new Proxy) bool
- func (ps ProxyList) Len() int
- func (ps ProxyList) Less(i, j int) bool
- func (ps ProxyList) NameAddCountry() ProxyList
- func (ps ProxyList) NameAddIndex() ProxyList
- func (ps ProxyList) NameAddTG() ProxyList
- func (ps ProxyList) NameClear() ProxyList
- func (ps ProxyList) NameReIndex() ProxyList
- func (ps ProxyList) Sort() ProxyList
- func (ps ProxyList) Swap(i, j int)
- func (ps ProxyList) ToProxyMap() ProxyMap
- func (ps ProxyList) TypeCounts() (ss, ssr, vmess, trojan, vless, anytls int)
- func (ps ProxyList) TypeLen(t string) int
- func (ps *ProxyList) UniqAppendProxy(new Proxy) ProxyList
- func (ps *ProxyList) UniqAppendProxyList(new ProxyList) ProxyList
- func (ps *ProxyList) UniqAppendProxyList2(new ProxyList) ProxyList
- type ProxyMap
- type Shadowsocks
- func (ss Shadowsocks) Clone() Proxy
- func (ss Shadowsocks) Identifier() string
- func (ss Shadowsocks) Link() (link string)
- func (ss Shadowsocks) String() string
- func (ss Shadowsocks) ToClash() string
- func (ss Shadowsocks) ToLoon() string
- func (ss Shadowsocks) ToQuanX() string
- func (ss Shadowsocks) ToSurge() string
- type ShadowsocksR
- func (ssr ShadowsocksR) Clone() Proxy
- func (ssr ShadowsocksR) Identifier() string
- func (ssr ShadowsocksR) Link() (link string)
- func (ssr ShadowsocksR) String() string
- func (ssr ShadowsocksR) ToClash() string
- func (ssr ShadowsocksR) ToLoon() string
- func (ssr ShadowsocksR) ToQuanX() string
- func (ssr ShadowsocksR) ToSurge() string
- type Trojan
- type Vless
- func (v Vless) Clone() Proxy
- func (v Vless) Identifier() string
- func (v Vless) Link() (link string)
- func (v Vless) String() string
- func (v Vless) ToClash() string
- func (v Vless) ToLoon() string
- func (v Vless) ToQuanX() string
- func (v Vless) ToSurge() string
- func (v *Vless) UnmarshalJSON(data []byte) error
- type Vmess
Constants ¶
This section is empty.
Variables ¶
var ( ErrorNotSSRLink = errors.New("not a correct ssr link") ErrorPasswordParseFail = errors.New("password parse failed") ErrorPathNotComplete = errors.New("path not complete") ErrorMissingQuery = errors.New("link missing query") ErrorProtocolParamParseFail = errors.New("protocol param parse failed") ErrorObfsParamParseFail = errors.New("obfs param parse failed") )
var ( ErrorNotVmessLink = errors.New("not a correct vmess link") ErrorVmessPayloadParseFail = errors.New("vmess link payload parse failed") )
var ErrorNotAnyTLSLink = errors.New("not a correct anytls link")
ErrorNotAnyTLSLink 非法的 anytls 链接
var ErrorNotSSLink = errors.New("not a correct ss link")
ErrorNotSSLink is an error type
var ErrorNotTrojanink = errors.New("not a correct trojan link")
var ErrorNotVlessLink = errors.New("not a correct vless link")
ErrorNotVlessLink 非法的 vless 链接
var ErrorTypeCanNotConvert = errors.New("type not support")
var SSCipherList = []string{
"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",
"rc4-md5",
"chacha20-ietf",
"xchacha20",
"chacha20-ietf-poly1305",
"xchacha20-ietf-poly1305",
}
var SSRCipherList = []string{
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"aes-128-ctr",
"aes-192-ctr",
"aes-256-ctr",
"aes-128-ofb",
"aes-192-ofb",
"aes-256-ofb",
"des-cfb",
"bf-cfb",
"cast5-cfb",
"rc4-md5",
"chacha20-ietf",
"salsa20",
"camellia-128-cfb",
"camellia-192-cfb",
"camellia-256-cfb",
"idea-cfb",
"rc2-cfb",
"seed-cfb",
}
Functions ¶
func GrepAnyTLSLinkFromString ¶ added in v1.1.44
GrepAnyTLSLinkFromString 从文本中抓取 anytls 链接
func GrepSSLinkFromString ¶
GrepSSLinkFromString() remove web fuzz characters before a ss link
func GrepSSRLinkFromString ¶
func GrepVlessLinkFromString ¶ added in v1.1.31
GrepVlessLinkFromString 从文本中抓取 vless 链接
func GrepVmessLinkFromString ¶
func ToClashMap ¶ added in v1.1.22
ToClashMap 将代理转换为 mihomo adapter.ParseProxy 所需的配置 map。 替代原先 String() → json.Unmarshal 的往返转换:健康检查、测速、中转检测 会对每个代理调用一次,消除大批量检测时的 JSON 序列化/反序列化开销。 键名与空值省略规则与各结构体的 json tag 完全一致,保证与旧行为等价 (mihomo 解码器按这些键读取,弱类型转换)。
Types ¶
type AnyTLS ¶ added in v1.1.44
type AnyTLS struct {
Base
Password string `yaml:"password" json:"password"`
ALPN []string `yaml:"alpn,omitempty" json:"alpn,omitempty"`
SNI string `yaml:"sni,omitempty" json:"sni,omitempty"`
SkipCertVerify bool `yaml:"skip-cert-verify,omitempty" json:"skip-cert-verify,omitempty"`
UDP bool `yaml:"udp,omitempty" json:"udp,omitempty"`
}
AnyTLS 是 anytls 协议代理(基于 TLS,2025 新协议,mihomo 原生支持)
func ParseAnyTLSLink ¶ added in v1.1.44
ParseAnyTLSLink 解析 anytls://password@host:port?sni=...&alpn=...#name
func (AnyTLS) Identifier ¶ added in v1.1.44
func (AnyTLS) ToSurge ¶ added in v1.1.44
ToSurge 输出 surge 配置(iOS 5.17.0+ / Mac 6.4.3+,Surge 支持 AnyTLS v2) 参考 https://manual.nssurge.com/policies/anytls.html
type Base ¶
type Base struct {
Name string `yaml:"name" json:"name" gorm:"index"`
Server string `yaml:"server" json:"server" gorm:"index"`
Type string `yaml:"type" json:"type" gorm:"index"`
Country string `yaml:"country,omitempty" json:"country,omitempty" gorm:"index"`
Port int `yaml:"port" json:"port" gorm:"index"`
UDP bool `yaml:"udp,omitempty" json:"udp,omitempty"`
Useable bool `yaml:"useable,omitempty" json:"useable,omitempty" gorm:"index"`
}
Base implements interface Proxy. It's the basic proxy struct. Vmess etc extends Base
func (*Base) AddBeforeName ¶
func (*Base) SetCountry ¶
SetUseable() set Base info "Country" (string)
func (*Base) SetUseable ¶
SetUseable() set Base info "Useable" (true or false)
type HTTP2Options ¶
type HTTPOptions ¶
type Proxy ¶
type Proxy interface {
String() string
ToClash() string
ToSurge() string
ToLoon() string
ToQuanX() string
Link() string
Identifier() string
SetName(name string)
AddToName(name string)
SetIP(ip string)
TypeName() string // ss ssr vmess trojan
BaseInfo() *Base
Clone() Proxy
SetUseable(useable bool)
SetCountry(country string)
}
func ParseProxyFromLink ¶
type ProxyList ¶
type ProxyList []Proxy
func (ProxyList) Deduplication ¶
Deduplication by proxy identifier
func (ProxyList) NameAddCountry ¶
func (ProxyList) NameAddIndex ¶
func (ProxyList) NameReIndex ¶
func (ProxyList) ToProxyMap ¶ added in v0.7.2
func (ProxyList) TypeCounts ¶ added in v1.1.24
TypeCounts 单次遍历统计各类型数量(替代多次 TypeLen 的 O(4n) 扫描)
func (*ProxyList) UniqAppendProxy ¶
Append an unique new proxy to original ProxyList
func (*ProxyList) UniqAppendProxyList ¶
Append unique new proxies to original ProxyList
func (*ProxyList) UniqAppendProxyList2 ¶ added in v0.7.2
type ProxyMap ¶ added in v0.7.2
func (ProxyMap) ToProxyList ¶ added in v0.7.2
func (ProxyMap) UniqAppendProxy ¶ added in v0.7.2
type Shadowsocks ¶
type Shadowsocks struct {
Base
Password string `yaml:"password" json:"password"`
Cipher string `yaml:"cipher" json:"cipher"`
Plugin string `yaml:"plugin,omitempty" json:"plugin,omitempty"`
PluginOpts map[string]interface{} `yaml:"plugin-opts,omitempty" json:"plugin-opts,omitempty"`
}
Shadowsocks is a type of proxy
func Convert2SS ¶
func Convert2SS(p Proxy) (ss *Shadowsocks, err error)
Convert2SS convert proxy to Shadowsocks if possible
func ParseSSLink ¶
func ParseSSLink(link string) (*Shadowsocks, error)
ParseSSLink() parses an ss link to ss proxy
func (Shadowsocks) Clone ¶
func (ss Shadowsocks) Clone() Proxy
func (Shadowsocks) Identifier ¶
func (ss Shadowsocks) Identifier() string
Identifier generates an unique identifier of one proxy
func (Shadowsocks) Link ¶
func (ss Shadowsocks) Link() (link string)
https://shadowsocks.org/en/config/quick-guide.html Link converts a ss proxy to string
func (Shadowsocks) String ¶
func (ss Shadowsocks) String() string
func (Shadowsocks) ToClash ¶
func (ss Shadowsocks) ToClash() string
ToClash converts proxy to clash proxy string
func (Shadowsocks) ToLoon ¶
func (ss Shadowsocks) ToLoon() string
ToLoon converts proxy to loon proxy string
func (Shadowsocks) ToQuanX ¶ added in v1.1.33
func (ss Shadowsocks) ToQuanX() string
ToQuanX converts proxy to quanx string
func (Shadowsocks) ToSurge ¶
func (ss Shadowsocks) ToSurge() string
ToSurge converts proxy to surge proxy string
type ShadowsocksR ¶
type ShadowsocksR struct {
Base
Password string `yaml:"password" json:"password"`
Cipher string `yaml:"cipher" json:"cipher"`
Protocol string `yaml:"protocol" json:"protocol"`
ProtocolParam string `yaml:"protocol-param,omitempty" json:"protocol-param,omitempty"`
Obfs string `yaml:"obfs" json:"obfs"`
ObfsParam string `yaml:"obfs-param,omitempty" json:"obfs-param,omitempty"`
Group string `yaml:"group,omitempty" json:"group,omitempty"`
}
字段依据clash的配置设计
func Convert2SSR ¶
func Convert2SSR(p Proxy) (ssr *ShadowsocksR, err error)
Convert2SS convert proxy to ShadowsocksR if possible
func ParseSSRLink ¶
func ParseSSRLink(link string) (*ShadowsocksR, error)
func (ShadowsocksR) Clone ¶
func (ssr ShadowsocksR) Clone() Proxy
func (ShadowsocksR) Identifier ¶
func (ssr ShadowsocksR) Identifier() string
func (ShadowsocksR) Link ¶
func (ssr ShadowsocksR) Link() (link string)
https://github.com/HMBSbige/ShadowsocksR-Windows/wiki/SSR-QRcode-scheme
func (ShadowsocksR) String ¶
func (ssr ShadowsocksR) String() string
func (ShadowsocksR) ToClash ¶
func (ssr ShadowsocksR) ToClash() string
func (ShadowsocksR) ToLoon ¶
func (ssr ShadowsocksR) ToLoon() string
func (ShadowsocksR) ToQuanX ¶ added in v1.1.33
func (ssr ShadowsocksR) ToQuanX() string
ToQuanX converts proxy to quanx string
func (ShadowsocksR) ToSurge ¶
func (ssr ShadowsocksR) ToSurge() string
type Trojan ¶
type Trojan struct {
Base
Password string `yaml:"password" json:"password"`
ALPN []string `yaml:"alpn,omitempty" json:"alpn,omitempty"`
SNI string `yaml:"sni,omitempty" json:"sni,omitempty"`
SkipCertVerify bool `yaml:"skip-cert-verify,omitempty" json:"skip-cert-verify,omitempty"`
UDP bool `yaml:"udp,omitempty" json:"udp,omitempty"`
}
func ParseTrojanLink ¶
func (Trojan) Identifier ¶
type Vless ¶ added in v1.1.31
type Vless struct {
Base
UUID string `yaml:"uuid" json:"uuid"`
Encryption string `yaml:"encryption,omitempty" json:"encryption,omitempty"`
Flow string `yaml:"flow,omitempty" json:"flow,omitempty"`
Network string `yaml:"network,omitempty" json:"network,omitempty"`
WSPath string `yaml:"ws-path,omitempty" json:"ws-path,omitempty"`
Host string `yaml:"host,omitempty" json:"host,omitempty"`
ServerName string `yaml:"servername,omitempty" json:"servername,omitempty"`
Fingerprint string `yaml:"fingerprint,omitempty" json:"fingerprint,omitempty"`
TLS bool `yaml:"tls,omitempty" json:"tls,omitempty"`
SkipCertVerify bool `yaml:"skip-cert-verify,omitempty" json:"skip-cert-verify,omitempty"`
UDP bool `yaml:"udp,omitempty" json:"udp,omitempty"`
// Reality 参数(security=reality)
RealityPublicKey string `yaml:"reality-public-key,omitempty" json:"reality-public-key,omitempty"`
RealityShortID string `yaml:"reality-short-id,omitempty" json:"reality-short-id,omitempty"`
SpiderX string `yaml:"spiderx,omitempty" json:"spiderx,omitempty"` // 客户端本地行为,仅用于链接往返
// grpc 传输参数(type=grpc)
GrpcServiceName string `yaml:"grpc-service-name,omitempty" json:"grpc-service-name,omitempty"`
}
Vless 是 vless 协议代理
支持形式:
- 传输:tcp / ws / grpc
- 安全:tls / reality(pbk + sid)
- flow:xtls-rprx-vision 等
- 输出:Clash / Loon / QuanX / vless:// 链接
- 健康检查/测速(mihomo 解析)
func ParseVlessLink ¶ added in v1.1.31
ParseVlessLink 解析 vless://uuid@host:port?...#name 链接
func (Vless) Identifier ¶ added in v1.1.31
func (Vless) ToLoon ¶ added in v1.1.31
ToLoon 输出 loon 配置(官方格式:name = VLESS, server, port, "uuid", transport=..., flow=..., public-key=..., over-tls=true, sni=...)
func (*Vless) UnmarshalJSON ¶ added in v1.1.31
UnmarshalJSON 兼容 clash 配置的 ws-opts 嵌套结构: clash 配置里 ws 传输用 ws-opts:{path, headers:{Host}},而结构体字段是扁平的
type Vmess ¶
type Vmess struct {
Base
UUID string `yaml:"uuid" json:"uuid"`
AlterID int `yaml:"alterId" json:"alterId"`
Cipher string `yaml:"cipher" json:"cipher"`
Network string `yaml:"network,omitempty" json:"network,omitempty"`
WSPath string `yaml:"ws-path,omitempty" json:"ws-path,omitempty"`
ServerName string `yaml:"servername,omitempty" json:"servername,omitempty"`
WSHeaders map[string]string `yaml:"ws-headers,omitempty" json:"ws-headers,omitempty"`
HTTPOpts HTTPOptions `yaml:"http-opts,omitempty" json:"http-opts,omitempty"`
HTTP2Opts HTTP2Options `yaml:"h2-opts,omitempty" json:"h2-opts,omitempty"`
TLS bool `yaml:"tls,omitempty" json:"tls,omitempty"`
SkipCertVerify bool `yaml:"skip-cert-verify,omitempty" json:"skip-cert-verify,omitempty"`
}