Documentation
¶
Index ¶
- Constants
- Variables
- func Fetch(proto, src string, transformer Transformer, parser Parser) int
- func FromBase64(buf []byte) []byte
- func FromClash(buf []byte) []byte
- func FromRaw(buf []byte) []byte
- func IsLocal(ip string) bool
- func Load(proto string, content []byte) error
- func RegisterParser(name string, parser Parser)
- func RegisterTransformer(name string, t Transformer)
- func Save(it *Proxy)
- func WriteTo(dir string)
- func WriteTotalAndUpdateReadme(dir string, counters map[string]int)
- type ClashConfig
- type ClashGRPCOpts
- type ClashH2Opts
- type ClashProxy
- type ClashRealityOpts
- type ClashWSHeaders
- type ClashWSOpts
- type FlexPort
- type Parser
- type Proxy
- type Transformer
Constants ¶
View Source
const ( // MaxSchemeLength defines the maximum allowed length for proxy scheme. // Legitimate proxy protocols (http, https, socks4, socks5, vmess, trojan, vless, ss, ssr, hy, hy2) // are all 6 characters or less. 15 provides safe headroom for future protocols. MaxSchemeLength = 15 )
Variables ¶
View Source
var ( Parsers = map[string]Parser{} ErrInvalidProxy = errors.New("gfp: invalid proxy") )
View Source
var (
Transformers = map[string]Transformer{}
)
Functions ¶
func FromBase64 ¶
func RegisterParser ¶
func RegisterTransformer ¶
func RegisterTransformer(name string, t Transformer)
Types ¶
type ClashConfig ¶
type ClashConfig struct {
Proxies []ClashProxy `yaml:"proxies"`
}
ClashConfig represents a Clash YAML configuration.
type ClashGRPCOpts ¶
type ClashGRPCOpts struct {
ServiceName string `yaml:"grpc-service-name,omitempty"`
}
ClashGRPCOpts represents gRPC transport options.
type ClashH2Opts ¶
type ClashH2Opts struct {
Path string `yaml:"path,omitempty"`
Host []string `yaml:"host,omitempty"`
}
ClashH2Opts represents HTTP/2 transport options.
type ClashProxy ¶
type ClashProxy struct {
Name string `yaml:"name,omitempty"`
Type string `yaml:"type"`
Server string `yaml:"server"`
Port FlexPort `yaml:"port"`
Cipher string `yaml:"cipher,omitempty"`
Password string `yaml:"password,omitempty"`
Username string `yaml:"username,omitempty"`
UUID string `yaml:"uuid,omitempty"`
AlterID int `yaml:"alterId,omitempty"`
Network string `yaml:"network,omitempty"`
TLS bool `yaml:"tls,omitempty"`
ServerName string `yaml:"servername,omitempty"`
SNI string `yaml:"sni,omitempty"`
Flow string `yaml:"flow,omitempty"`
ClientFingerprint string `yaml:"client-fingerprint,omitempty"`
WSOpts *ClashWSOpts `yaml:"ws-opts,omitempty"`
GRPCOpts *ClashGRPCOpts `yaml:"grpc-opts,omitempty"`
H2Opts *ClashH2Opts `yaml:"h2-opts,omitempty"`
RealityOpts *ClashRealityOpts `yaml:"reality-opts,omitempty"`
}
ClashProxy represents a single proxy entry in a Clash config.
type ClashRealityOpts ¶
type ClashRealityOpts struct {
PublicKey string `yaml:"public-key,omitempty"`
ShortID string `yaml:"short-id,omitempty"`
}
ClashRealityOpts represents Reality TLS options.
type ClashWSHeaders ¶
type ClashWSHeaders struct {
Host string `yaml:"Host,omitempty"`
}
ClashWSHeaders represents WebSocket headers in Clash config.
type ClashWSOpts ¶
type ClashWSOpts struct {
Path string `yaml:"path,omitempty"`
Headers ClashWSHeaders `yaml:"headers,omitempty"`
}
ClashWSOpts represents WebSocket transport options.
type FlexPort ¶
type FlexPort int
FlexPort handles YAML port values that may be int, float, or string.
type Proxy ¶
type Proxy struct {
IP string `json:"ip"`
Port int `json:"port"`
User string `json:"user"`
Passwd string `json:"passwd"`
Opaque string `json:"opaque"`
Protocol string `json:"protocol"`
}
func ParseColonURL ¶
func ParseProxyURL ¶
func ParseSpaceURL ¶
type Transformer ¶
func GetTransformer ¶
func GetTransformer(name string) Transformer
Click to show internal directories.
Click to hide internal directories.