proxy

package
v0.0.0-...-4343b11 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var (
	ErrorNotVmessLink          = errors.New("not a correct vmess link")
	ErrorVmessPayloadParseFail = errors.New("vmess link payload parse failed")
)
View Source
var (
	ErrorNotSSLink = errors.New("not a correct ss link")
)
View Source
var (
	ErrorNotTrojanink = errors.New("not a correct trojan link")
)
View Source
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",
}
View Source
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 GrepSSLinkFromString

func GrepSSLinkFromString(text string) []string

func GrepSSRLinkFromString

func GrepSSRLinkFromString(text string) []string

func GrepTrojanLinkFromString

func GrepTrojanLinkFromString(text string) []string

func GrepVmessLinkFromString

func GrepVmessLinkFromString(text string) []string

func InitGeoIpDB

func InitGeoIpDB()

Types

type Base

type Base struct {
	Name    string `yaml:"name" json:"name" gorm:"index"`
	Server  string `yaml:"server" json:"server" gorm:"index"`
	Port    int    `yaml:"port" json:"port" gorm:"index"`
	Type    string `yaml:"type" json:"type" gorm:"index"`
	UDP     bool   `yaml:"udp,omitempty" json:"udp,omitempty"`
	Country string `yaml:"country,omitempty" json:"country,omitempty" gorm:"index"`
	Useable bool   `yaml:"useable,omitempty" json:"useable,omitempty" gorm:"index"`
}

func (*Base) BaseInfo

func (b *Base) BaseInfo() *Base

func (*Base) Clone

func (b *Base) Clone() Base

func (*Base) SetCountry

func (b *Base) SetCountry(country string)

func (*Base) SetIP

func (b *Base) SetIP(ip string)

func (*Base) SetName

func (b *Base) SetName(name string)

func (*Base) SetUseable

func (b *Base) SetUseable(useable bool)

func (*Base) TypeName

func (b *Base) TypeName() string

type CountryEmoji

type CountryEmoji struct {
	Code  string `json:"code"`
	Emoji string `json:"emoji"`
}

type GeoIP

type GeoIP struct {
	// contains filtered or unexported fields
}

GeoIP2

func NewGeoIP

func NewGeoIP(geodb, flags string) (geoip GeoIP)

new geoip from db file

func (GeoIP) Find

func (g GeoIP) Find(ipORdomain string) (ip, country string, err error)

find ip info

type HTTPOptions

type HTTPOptions struct {
	Method  string              `yaml:"method,omitempty" json:"method,omitempty"`
	Path    []string            `yaml:"path,omitempty" json:"path,omitempty"`
	Headers map[string][]string `yaml:"headers,omitempty" json:"headers,omitempty"`
}

type Proxy

type Proxy interface {
	String() string
	ToClash() string
	ToSurge() string
	Link() string
	Identifier() string
	SetName(name string)
	SetIP(ip string)
	TypeName() string
	BaseInfo() *Base
	Clone() Proxy
	SetUseable(useable bool)
	SetCountry(country string)
}

func CleanBadProxies

func CleanBadProxies(proxies []Proxy) (cproxies []Proxy)

func CleanBadProxiesWithGrpool

func CleanBadProxiesWithGrpool(proxies []Proxy) (cproxies []Proxy)

type ProxyList

type ProxyList []Proxy

func Deduplication

func Deduplication(src ProxyList) ProxyList

func (ProxyList) Clone

func (ps ProxyList) Clone() ProxyList

func (ProxyList) Deduplication

func (ps ProxyList) Deduplication() ProxyList

func (ProxyList) Len

func (ps ProxyList) Len() int

func (ProxyList) Less

func (ps ProxyList) Less(i, j int) bool

func (ProxyList) NameAddCounrty

func (ps ProxyList) NameAddCounrty() ProxyList

func (ProxyList) NameAddIndex

func (ps ProxyList) NameAddIndex() ProxyList

func (ProxyList) NameAddTG

func (ps ProxyList) NameAddTG() ProxyList

func (ProxyList) NameReIndex

func (ps ProxyList) NameReIndex() ProxyList

func (ProxyList) Sort

func (ps ProxyList) Sort() ProxyList

func (ProxyList) Swap

func (ps ProxyList) Swap(i, j int)

func (ProxyList) TypeLen

func (ps ProxyList) TypeLen(t string) int

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"`
}
func ParseSSLink(link string) (*Shadowsocks, error)

func SSR2SS

func SSR2SS(ssr *ShadowsocksR) (ss *Shadowsocks, err error)

func (Shadowsocks) Clone

func (ss Shadowsocks) Clone() Proxy

func (Shadowsocks) Identifier

func (ss Shadowsocks) Identifier() string
func (ss Shadowsocks) Link() (link string)

https://shadowsocks.org/en/config/quick-guide.html

func (Shadowsocks) String

func (ss Shadowsocks) String() string

func (Shadowsocks) ToClash

func (ss Shadowsocks) ToClash() string

func (Shadowsocks) ToSurge

func (ss Shadowsocks) ToSurge() 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"`
}
func ParseSSRLink(link string) (*ShadowsocksR, error)

func SS2SSR

func SS2SSR(ss *Shadowsocks) (ssr *ShadowsocksR, err error)

func (ShadowsocksR) Clone

func (ssr ShadowsocksR) Clone() Proxy

func (ShadowsocksR) Identifier

func (ssr ShadowsocksR) Identifier() string

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"`
	UDP            bool     `yaml:"udp,omitempty" json:"udp,omitempty"`
}
func ParseTrojanLink(link string) (*Trojan, error)

func (Trojan) Clone

func (t Trojan) Clone() Proxy

func (Trojan) Identifier

func (t Trojan) Identifier() string

func (Trojan) String

func (t Trojan) String() string

func (Trojan) ToClash

func (t Trojan) ToClash() string

func (Trojan) ToSurge

func (t Trojan) ToSurge() string

type Vmess

type Vmess struct {
	Base
	UUID           string            `yaml:"uuid" json:"uuid"`
	AlterID        int               `yaml:"alterId" json:"alterId"`
	Cipher         string            `yaml:"cipher" json:"cipher"`
	TLS            bool              `yaml:"tls,omitempty" json:"tls,omitempty"`
	Network        string            `yaml:"network,omitempty" json:"network,omitempty"`
	HTTPOpts       HTTPOptions       `yaml:"http-opts,omitempty" json:"http-opts,omitempty"`
	WSPath         string            `yaml:"ws-path,omitempty" json:"ws-path,omitempty"`
	WSHeaders      map[string]string `yaml:"ws-headers,omitempty" json:"ws-headers,omitempty"`
	SkipCertVerify bool              `yaml:"skip-cert-verify,omitempty" json:"skip-cert-verify,omitempty"`
	ServerName     string            `yaml:"servername,omitempty" json:"servername,omitempty"`
}
func ParseVmessLink(link string) (*Vmess, error)

func (Vmess) Clone

func (v Vmess) Clone() Proxy

func (Vmess) Identifier

func (v Vmess) Identifier() string
func (v Vmess) Link() (link string)

func (Vmess) String

func (v Vmess) String() string

func (Vmess) ToClash

func (v Vmess) ToClash() string

func (Vmess) ToSurge

func (v Vmess) ToSurge() string

Jump to

Keyboard shortcuts

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