define

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RulesetTypes = map[string]RulesetType{
	"clash-domain:": RULESET_CLASH_DOMAIN,
	"clash-ipcidr:": RULESET_CLASH_IPCIDR,
	"clash:":        RULESET_CLASH_CLASSICAL,
	"quanx:":        RULESET_QUANX,
	"surge:":        RULESET_SURGE,
}

Functions

func AnyTLSProxyInit added in v0.0.10

func AnyTLSProxyInit(node *Proxy, group, remarks, server, port, password, sni, alpn, fingerprint, idleSessionCheckInterval, idleSessionTimeout, minIdleSession string, tfo, scv Tribool)

func GetRulesetContentName added in v0.0.8

func GetRulesetContentName(rulePath []string) string

func HttpProxyInit

func HttpProxyInit(node *Proxy, group, remarks, server, port, username, password string, tls bool, tfo, scv, tls13 Tribool)

func Hysteria2ProxyInit added in v0.0.12

func Hysteria2ProxyInit(node *Proxy, group, remarks, server, port, ports, up, down, password, obfs, obfsPassword, sni, fingerprint, alpn, ca, caStr, cwnd, hopInterval string, tfo, scv Tribool)

func SSProxyInit

func SSProxyInit(node *Proxy, group, remarks, server, port, password, method, plugin, pluginopts string, udp, tfo, scv, tls13 Tribool)

func SnellProxyInit

func SnellProxyInit(node *Proxy, group, remarks, server, port, password, obfs, host string, version uint16, udp, tfo, scv Tribool)

func SocksProxyInit

func SocksProxyInit(node *Proxy, group, remarks, server, port, username, password string, udp, tfo, scv Tribool)

func TrojanProxyInit

func TrojanProxyInit(node *Proxy, group, remarks, server, port, password, network, host, path string, tlssecure bool, udp, tfo, scv, tls13 Tribool)

func TuicProxyInit added in v0.0.10

func TuicProxyInit(node *Proxy, group, remarks, server, port, uuid, password, ip, heartbeatInterval, alpn, disableSNI, reduceRTT, requestTimeout, udpRelayMode, congestionController, maxUdpRelayPacketSize, maxOpenStreams, sni, fastOpen string, tfo, scv Tribool)

func VMessProxyInit

func VMessProxyInit(node *Proxy, group, remarks, server, port, fakeType, id, aid, net, cipher, path, host, edge, tls, sni string, udp, tfo, scv, tls13 Tribool)

func VlessProxyInit

func VlessProxyInit(node *Proxy, group, remarks, address, port, fakeType, id, aid, net, cipher, flow, mode, path, host, edge, tls, pbk, sid, fp, clientFingerprint string, udp, tfo, scv, tls13 Tribool)

func WireGuardProxyInit

func WireGuardProxyInit(node *Proxy, group, remarks, server, port, selfIp, selfIpv6, privKey, pubKey, psk string, dns []string, mtu, keepalive, testUrl, clientId string, udp Tribool)

Types

type BalanceStrategy

type BalanceStrategy int
const (
	BalanceStrategy_ConsistentHashing BalanceStrategy = iota
	BalanceStrategy_RoundRobin
)

type ConfType

type ConfType int
const (
	ConfType_Unknow ConfType = iota
	ConfType_SS
	ConfType_SSR
	ConfType_V2Ray
	ConfType_SSConf
	ConfType_SSTap
	ConfType_Netch
	ConfType_SOCKS
	ConfType_HTTP
	ConfType_SUB
	ConfType_Local
)

type ExternalConfig

type ExternalConfig struct {
	CustomProxyGroups []*ProxyGroupConfig
	RulesetConfigs    []*RulesetConfig
	ClashRuleBase     string
	//SurgeRuleBase          string
	//SurfboardRuleBase      string
	//MellowRuleBase         string
	//QuanRuleBase           string
	//QuanxRuleBase          string
	//LoonRuleBase           string
	//SssubRuleBase          string
	SingboxRuleBase        string
	Rename                 []*RegexMatchConfig
	Emoji                  []*RegexMatchConfig
	Include                []string
	Exclude                []string
	TplArgs                map[string]interface{}
	OverwriteOriginalRules bool
	EnableRuleGenerator    bool
	AddEmoji               bool
	RemoveOldEmoji         bool
}

func NewExternalConfig

func NewExternalConfig() *ExternalConfig

type ExtraSettings

type ExtraSettings struct {
	NodePref                   *config.AppConfigNodePref
	AppendProxyType            Tribool
	SkipCertVerify             Tribool
	FilterDeprecated           Tribool
	UDP                        Tribool
	TFO                        Tribool
	ManagedConfigPrefix        string
	ClashScript                bool
	EnableRuleGenerator        bool
	OverwriteOriginalRules     bool
	ClashRuleSetOptimize       bool
	ClashGeoConvertRuleSet     bool
	ClashRulesetOptimizeToHttp bool
	RequestHost                string
	RequestHostWithProtocol    string
}

func NewExtraSettings

func NewExtraSettings() *ExtraSettings

type Proxy

type Proxy struct {
	Type ProxyType

	Id      uint32
	GroupId uint32
	Group   string
	Remark  string

	Hostname string
	Port     uint16

	Username         string
	Password         string
	EncryptMethod    string
	Plugin           string
	PluginOption     string
	Protocol         string
	ProtocolParam    string
	OBFS             string
	OBFSParam        string
	UserId           string
	AlterId          uint16
	TransferProtocol string
	FakeType         string
	TLSSecure        bool

	Flow     string
	FlowShow bool

	Host string
	Path string
	Edge string

	QUICSecure      string
	QUICSecret      string
	GRPCServiceName string
	GRPCMode        string

	UDP           Tribool
	TCPFastOpen   Tribool
	AllowInsecure Tribool
	TLS13         Tribool

	SnellVersion uint16
	ServerName   string

	SelfIP       string
	SelfIPv6     string
	PublicKey    string
	PrivateKey   string
	PreSharedKey string
	DnsServers   []string
	Mtu          uint16
	AllowedIPs   string
	KeepAlive    uint16
	TestUrl      string
	ClientId     string

	Fingerprint       string
	ShortId           string
	ClientFingerprint string

	// TUIC fields
	UUID                  string
	HeartbeatInterval     string
	DisableSNI            string
	ReduceRTT             string
	RequestTimeout        uint32
	UdpRelayMode          string
	CongestionController  string
	MaxUdpRelayPacketSize uint32
	MaxOpenStreams        uint32
	FastOpen              Tribool
	Alpn                  []string

	// ANYTLS session management fields
	IdleSessionCheckInterval uint32
	IdleSessionTimeout       uint32
	MinIdleSession           uint32

	// Hysteria2 fields
	Ports       string // Server ports for port hopping
	UpSpeed     uint32 // Upload speed in Mbps
	DownSpeed   uint32 // Download speed in Mbps
	Ca          string // CA certificate path
	CaStr       string // CA certificate content
	CWND        uint32 // Congestion window
	HopInterval uint32 // Port hop interval in seconds
}

func NewProxy

func NewProxy() *Proxy

type ProxyGroupConfig

type ProxyGroupConfig struct {
	Name              string
	Type              ProxyGroupType
	Proxies           []string
	UsingProvider     []string
	Url               string
	Interval          int
	Timeout           int
	Tolerance         int
	Strategy          BalanceStrategy
	Lazy              Tribool
	DisableUdp        Tribool
	Persistent        Tribool
	EvaluateBeforeUse Tribool
}

func (*ProxyGroupConfig) StrategyStr

func (p *ProxyGroupConfig) StrategyStr() string

func (*ProxyGroupConfig) TypeStr

func (p *ProxyGroupConfig) TypeStr() string

type ProxyGroupType

type ProxyGroupType int
const (
	ProxyGroupType_Select ProxyGroupType = iota
	ProxyGroupType_URLTest
	ProxyGroupType_LoadBalance
	ProxyGroupType_Fallback
	ProxyGroupType_Relay
	ProxyGroupType_SSID
	ProxyGroupType_Smart
)

type ProxyType

type ProxyType int
const (
	ProxyType_Unknown ProxyType = iota
	ProxyType_Shadowsocks
	ProxyType_VMess
	ProxyType_Trojan
	ProxyType_Snell
	ProxyType_HTTP
	ProxyType_HTTPS
	ProxyType_SOCKS5
	ProxyType_WireGuard
	ProxyType_VLESS
	ProxyType_TUIC
	ProxyType_ANYTLS
	ProxyType_Hysteria2
)

func (ProxyType) String

func (p ProxyType) String() string

type RegexMatchConfig

type RegexMatchConfig struct {
	Match   string
	Replace string
	Script  string
}

type RulesetConfig

type RulesetConfig struct {
	Group    string
	Url      string
	Interval int
}

func NewRulesetConfig

func NewRulesetConfig() *RulesetConfig

func (*RulesetConfig) Equal

func (c *RulesetConfig) Equal(r *RulesetConfig) bool

type RulesetContent

type RulesetContent struct {
	RuleGroup      string
	RulePath       []string
	RulePathTyped  string
	RuleType       RulesetType
	RuleContent    string
	UpdateInterval int
}

func CreateRulesetContentFromUrls added in v0.0.8

func CreateRulesetContentFromUrls(urls []string, group string, ruleType RulesetType) *RulesetContent

func ParseRulesetContents

func ParseRulesetContents(rulesetConfig []*RulesetConfig) []*RulesetContent

func (*RulesetContent) GetRuleSetName added in v0.0.5

func (l *RulesetContent) GetRuleSetName() string

type RulesetType

type RulesetType int

enum ruleset_type

const (
	RULESET_SURGE RulesetType = iota
	RULESET_QUANX
	RULESET_CLASH_DOMAIN
	RULESET_CLASH_IPCIDR
	RULESET_CLASH_CLASSICAL
)

type Tribool

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

Tribool 表示三态布尔类型

func GetTriboolFromMap

func GetTriboolFromMap(jsonData map[string]interface{}, key string) Tribool

func NewTribool

func NewTribool() Tribool

NewTribool 创建一个新的 Tribool,默认为 indeterminate

func NewTriboolFromBool

func NewTriboolFromBool(b bool) Tribool

NewTriboolFromBool 从 bool 创建 Tribool

func NewTriboolFromBoolPointer added in v0.0.2

func NewTriboolFromBoolPointer(b *bool) Tribool

func NewTriboolFromString

func NewTriboolFromString(str string) Tribool

NewTriboolFromString 从字符串创建 Tribool

func (Tribool) Bool

func (t Tribool) Bool() bool

Bool 将 Tribool 转换为 bool(不确定状态视为 false)

func (*Tribool) Clear

func (t *Tribool) Clear()

Clear 将 Tribool 重置为不确定状态

func (*Tribool) Define

func (t *Tribool) Define(value bool) *Tribool

Define 如果当前为不确定状态,则设置为指定值

func (*Tribool) DefineTriBool

func (t *Tribool) DefineTriBool(value Tribool) *Tribool

func (Tribool) Equal

func (t Tribool) Equal(other Tribool) bool

Equal 检查两个 Tribool 是否相等

func (Tribool) Get

func (t Tribool) Get(defValue bool) bool

Get 获取 Tribool 的值,如果为不确定状态则返回默认值

func (Tribool) GetStr

func (t Tribool) GetStr() string

GetStr 获取 Tribool 的字符串表示

func (Tribool) IsUndef

func (t Tribool) IsUndef() bool

IsUndef 检查是否为不确定状态

func (*Tribool) Parse

func (t *Tribool) Parse(value bool) *Tribool

Parse 是 Define 的别名

func (*Tribool) Reverse

func (t *Tribool) Reverse() *Tribool

Reverse 反转 Tribool 的值

func (*Tribool) Set

func (t *Tribool) Set(str string) bool

Set 从字符串设置 Tribool 的值

Jump to

Keyboard shortcuts

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