Documentation
¶
Index ¶
- Variables
- func GoodNodeThatClashUnsupported(b Proxy) bool
- func GrepHysteria2LinkFromString(text string) []string
- func GrepHysteriaLinkFromString(text string) []string
- func GrepSSLinkFromString(text string) []string
- func GrepSSRLinkFromString(text string) []string
- func GrepTrojanLinkFromString(text string) []string
- func GrepTuicLinkFromString(text string) []string
- func GrepVlessLinkFromString(text string) []string
- func GrepVmessLinkFromString(text string) []string
- func ValidParams(param interface{}) (flag bool)
- 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 GrpcOptions
- type HTTP2Options
- type HTTPOptions
- type Hysteria
- type Hysteria2
- type Proxy
- type ProxyList
- func (ps ProxyList) Clone() ProxyList
- func (ps ProxyList) Deduplication() ProxyList
- func (ps ProxyList) Derive() ProxyList
- func (ps ProxyList) Len() int
- func (ps ProxyList) Less(i, j int) bool
- func (ps ProxyList) NameAddCounrty() 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) TypeLen(t string) int
- func (ps *ProxyList) UniqAppendProxy(new Proxy) ProxyList
- func (ps *ProxyList) UniqAppendProxyList(new ProxyList) ProxyList
- type RealityOpts
- type Shadowsocks
- type ShadowsocksR
- type Trojan
- type TrojanWSOptions
- type Tuic
- type Vless
- type Vmess
- type WSOptions
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") ErrorOtDomainParseFail = errors.New("ot_domain parse failed") ErrorOtPathParseFail = errors.New("ot_path parse failed") )
var ( ErrorNotVmessLink = errors.New("not a correct vmess link") ErrorVmessPayloadParseFail = errors.New("vmess link payload parse failed") )
var (
ErrorNotHysteria2Link = errors.New("not a correct hysteria2 link")
)
var (
ErrorNotHysteriaLink = errors.New("not a correct hysteria link")
)
var ( // ErrorNotSSLink is an error type ErrorNotSSLink = errors.New("not a correct ss link") )
var (
ErrorNotTrojanLink = errors.New("not a correct trojan link")
)
var (
ErrorNotTuicLink = errors.New("not a correct tuic link")
)
var (
ErrorNotVlessLink = errors.New("not a correct vless link")
)
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{
"none",
"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",
}
var (
TuicPlainRe = regexp.MustCompile("tuic://([A-Za-z0-9+/_&?=@:%.-])+")
)
Functions ¶
func GrepSSLinkFromString ¶
GrepSSLinkFromString() remove web fuzz characters before a ss link
func GrepSSRLinkFromString ¶
func GrepTuicLinkFromString ¶
func GrepVlessLinkFromString ¶
func GrepVmessLinkFromString ¶
func ValidParams ¶
func ValidParams(param interface{}) (flag bool)
Types ¶
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 GrpcOptions ¶
type GrpcOptions struct {
GrpcServiceName string `yaml:"grpc-service-name,omitempty" json:"grpc-service-name,omitempty"`
}
type HTTP2Options ¶
type HTTPOptions ¶
type Hysteria ¶
type Hysteria struct {
Base
Ports string `yaml:"ports,omitempty" json:"ports,omitempty"`
AUTHStr string `yaml:"auth_str,omitempty" json:"auth_str,omitempty"`
AUTH string `yaml:"auth-str,omitempty" json:"auth-str,omitempty"`
ALPN []string `yaml:"alpn,omitempty" json:"alpn,omitempty"`
SNI string `yaml:"sni,omitempty" json:"sni,omitempty"`
SkipCertVerify bool `yaml:"skip-cert-verify" json:"skip-cert-verify"`
OBFS string `yaml:"obfs,omitempty" json:"obgs,omitempty"`
FingerPrint string `yaml:"fingerprint,omitempty" json:"fingerprint,omitempty"`
CA string `yaml:"ca,omitempty" json:"ca,omitempty"`
CAStr string `yaml:"ca-str,omitempty" json:"ca-str,omitempty"`
CAStr2 string `yaml:"ca_str,omitempty" json:"ca_str,omitempty"`
UP string `yaml:"up" json:"up"`
DOWN string `yaml:"down" json:"down"`
Protocol string `yaml:"protocol" json:"protocol"`
RecvWindowConn string `yaml:"recv_window_conn,omitempty" json:"recv_window_conn,omitempty"`
RecvWindowConn2 string `yaml:"recv-window-conn,omitempty" json:"recv-window-conn,omitempty"`
RecvWindow string `yaml:"recv_window,omitempty" json:"recv_window,omitempty"`
RecvWindow2 string `yaml:"recv_window2,omitempty" json:"recv_window2,omitempty"`
DisableMtuDiscovery string `yaml:"disable_mtu_discovery,omitempty" json:"disable_mtu_discovery,omitempty"`
FastOpen string `yaml:"fast-open,omitempty" json:"fast-open,omitempty"`
}
func ParseHysteriaLink ¶
func (Hysteria) Identifier ¶
type Hysteria2 ¶
type Hysteria2 struct {
Base
Password string `yaml:"password" json:"password"`
AUTH string `yaml:"auth,omitempty" json:"auth,omitempty"`
ALPN []string `yaml:"alpn,omitempty" json:"alpn,omitempty"`
SNI string `yaml:"sni,omitempty" json:"sni,omitempty"`
SkipCertVerify bool `yaml:"skip-cert-verify" json:"skip-cert-verify"`
OBFS string `yaml:"obfs,omitempty" json:"obgs,omitempty"`
OBFSPassword string `yaml:"obfs-password,omitempty" json:"obfs-password,omitempty"`
FingerPrint string `yaml:"fingerprint,omitempty" json:"fingerprint,omitempty"`
CA string `yaml:"ca,omitempty" json:"ca,omitempty"`
CAStr string `yaml:"ca-str,omitempty" json:"ca-str,omitempty"`
UP string `yaml:"up,omitempty" json:"up,omitempty"`
DOWN string `yaml:"down,omitempty" json:"down,omitempty"`
Ports string `yaml:"ports,omitempty" json:"ports,omitempty"`
}
func ParseHysteria2Link ¶
func (Hysteria2) Identifier ¶
type Proxy ¶
type Proxy interface {
String() string
ToClash() string
ToSurge() 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) NameAddCounrty ¶
func (ProxyList) NameAddIndex ¶
func (ProxyList) NameReIndex ¶
func (*ProxyList) UniqAppendProxy ¶
Append an unique new proxy to original ProxyList
func (*ProxyList) UniqAppendProxyList ¶
Append unique new proxies to original ProxyList
type RealityOpts ¶
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) 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"`
Ot_enable int `yaml:"ot_enable,omitempty" json:"ot_enable,omitempty"`
Ot_domain string `yaml:"ot_domain,omitempty" json:"ot_domain,omitempty"`
Ot_path string `yaml:"ot_path,omitempty" json:"ot_path,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/ShadowsocksR-Live/shadowsocksr-native/wiki/QR-code-scheme
func (ShadowsocksR) String ¶
func (ssr ShadowsocksR) String() string
func (ShadowsocksR) ToClash ¶
func (ssr ShadowsocksR) ToClash() 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"`
WSOpts *TrojanWSOptions `yaml:"ws-opts,omitempty" json:"ws-opts,omitempty"`
FingerPrint string `yaml:"fingerprint,omitempty" json:"fingerprint,omitempty"`
Network string `yaml:"network,omitempty" json:"network,omitempty"`
GrpcOpts *GrpcOptions `yaml:"grpc-opts,omitempty" json:"grpc-opts,omitempty"`
Flow string `yaml:"flow,omitempty" json:"flow,omitempty"`
FlowShow bool `yaml:"flow-show,omitempty" json:"flow-show,omitempty"`
}
func ParseTrojanLink ¶
func (Trojan) Identifier ¶
type TrojanWSOptions ¶
type Tuic ¶
type Tuic struct {
Base
Password string `yaml:"password,omitempty" json:"password,omitempty"`
UUID string `yaml:"uuid,omitempty" json:"uuid,omitempty"`
Token string `yaml:"token,omitempty" json:"token,omitempty"`
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"`
DisableSni bool `yaml:"disable-sni,omitempty" json:"disable-sni,omitempty"`
ReduceRtt bool `yaml:"reduce-rtt,omitempty" json:"reduce-rtt,omitempty"`
UdpRelayMode string `yaml:"udp-relay-mode,omitempty" json:"udp-relay-mode,omitempty"`
CongestionController string `yaml:"congestion-controller,omitempty" json:"congestion-controller,omitempty"`
}
func ParseTuicLink ¶
func (Tuic) Identifier ¶
type Vless ¶
type Vless struct {
Base
UUID string `yaml:"uuid" json:"uuid"`
Network string `yaml:"network,omitempty" json:"network,omitempty"`
TLS bool `yaml:"tls,omitempty" json:"tls,omitempty"`
SkipCertVerify bool `yaml:"skip-cert-verify,omitempty" json:"skip-cert-verify,omitempty"`
Flow string `yaml:"flow,omitempty" json:"flow,omitempty"`
FingerPrint string `yaml:"fingerprint,omitempty" json:"fingerprint,omitempty"`
XUDP bool `yaml:"xudp,omitempty" json:"xudp,omitempty"`
ClientFingerprint string `yaml:"client-fingerprint,omitempty" json:"client-fingerprint,omitempty"`
ServerName string `yaml:"servername,omitempty" json:"servername,omitempty"`
RealityOpts *RealityOpts `yaml:"reality-opts,omitempty" json:"reality-opts,omitempty"`
GrpcOpts *GrpcOptions `yaml:"grpc-opts,omitempty" json:"grpc-opts,omitempty"`
WSOpts *WSOptions `yaml:"ws-opts,omitempty" json:"ws-opts,omitempty"`
ALPN []string `yaml:"alpn,omitempty" json:"alpn,omitempty"`
PacketEncoding string `yaml:"packet-encoding" json:"packet-encoding"`
}
func ParseVlessLink ¶
func (Vless) Identifier ¶
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"`
ServerName string `yaml:"servername,omitempty" json:"servername,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"`
WSOpts *WSOptions `yaml:"ws-opts,omitempty" json:"ws-opts,omitempty"`
ALPN []string `yaml:"alpn,omitempty" json:"alpn,omitempty"`
}