Documentation
¶
Index ¶
- type BuildConfig
- func (b *BuildConfig) AddCacheFile() error
- func (b *BuildConfig) AddClashApi() error
- func (b *BuildConfig) AddDnsRule(tagName string, server string) error
- func (b *BuildConfig) AddDnsRuleObj(rule option.DNSRule) error
- func (b *BuildConfig) AddDnsServer(dnsServer option.DNSServerOptions) error
- func (b *BuildConfig) AddDnsServerRaw(in []byte) error
- func (b *BuildConfig) AddExperminatl() error
- func (b *BuildConfig) AddExtranalOutbound() error
- func (b *BuildConfig) AddInbound(preName string) error
- func (b *BuildConfig) AddOutbound(sboxot db.Config, serverIN sbox.Inboud, sni string) error
- func (b *BuildConfig) AddRawDns(in []byte, tagName string) error
- func (b *BuildConfig) AddRawOut(out *option.Outbound) error
- func (b *BuildConfig) AddRawRoute(in []byte, ref string) error
- func (b *BuildConfig) AddRouteRule(tagName string, outbound string) error
- func (b *BuildConfig) AddRouteRuleOb(rule option.Rule) error
- func (b *BuildConfig) AddRouteRuleSet(ruleset option.RuleSet) error
- func (b *BuildConfig) AddRouteRuleSetRaw(rulesetraw []byte) error
- func (b *BuildConfig) AddToSelector(tag string)
- func (b *BuildConfig) AddoutJson(bound []byte) error
- func (b *BuildConfig) BuildDefault() error
- func (b *BuildConfig) BuildDefaultDns() error
- func (b *BuildConfig) BuildDefaultInbounds() error
- func (b *BuildConfig) BuildDefaultLog() error
- func (b *BuildConfig) BuildDefaultOutbound() error
- func (b *BuildConfig) BuildDefaultRoute() error
- func (b *BuildConfig) CacheFile() error
- func (b *BuildConfig) ChageTransport(tag string, transport *option.V2RayTransportOptions) error
- func (b *BuildConfig) ChangeCache(changer, val string) error
- func (b *BuildConfig) ChangeClash(changer, val string) error
- func (b *BuildConfig) ChangeDialer(outname, changer, value string) error
- func (b *BuildConfig) ChangeDnsServerOpts(tag, changer, val string) error
- func (b *BuildConfig) ChangeInboundOption(inname, changer, value string) error
- func (b *BuildConfig) ChangeMultiplex(outname, changer, value string) error
- func (b *BuildConfig) ChangeRuleSet(rulesetatg, changer, val string) error
- func (b *BuildConfig) ChangeSelfInbound(inname, changer, value string) error
- func (b *BuildConfig) ChangeSelfOutbound(outname, changer, value string) error
- func (b *BuildConfig) ChangeServer(outname string, newserver string) error
- func (b *BuildConfig) ChangeSni(outname string, newsni string) error
- func (b *BuildConfig) ChangeTLS(outname, changer, value string) error
- func (b *BuildConfig) ChangeTlsSettings(tag string, Tls *option.OutboundTLSOptions) error
- func (b *BuildConfig) ChangeTransport(outname, changer, value string) error
- func (b *BuildConfig) ChangeUUID(outname string, newuuid string) error
- func (b *BuildConfig) CheckDnsRule(tag string) bool
- func (b *BuildConfig) CheckDnsServer(tag string) bool
- func (b *BuildConfig) CheckOutbound(tag string) bool
- func (b *BuildConfig) CheckRule(tag string) bool
- func (b *BuildConfig) CheckRuleSet(tag string) bool
- func (b *BuildConfig) Close() error
- func (b *BuildConfig) DnsClient() error
- func (b *BuildConfig) Export() any
- func (b *BuildConfig) ExportAllInbounds() any
- func (b *BuildConfig) ExportAllOutbounds() any
- func (b *BuildConfig) ExportDns() any
- func (b *BuildConfig) ExportDnsRule(tag string) any
- func (b *BuildConfig) ExportDnsServer(tag string) any
- func (b *BuildConfig) ExportExpermental() any
- func (b *BuildConfig) ExportInbound(tag string) any
- func (b *BuildConfig) ExportOutbound(tag string) any
- func (b *BuildConfig) ExportRoute() any
- func (b *BuildConfig) ExportRouteRule(tag string) any
- func (b *BuildConfig) ExportRuleSet(tag string) any
- func (b *BuildConfig) GetAllInNames() []string
- func (b *BuildConfig) GetAllOutNames() []string
- func (b *BuildConfig) GetDnsRule(tag string) option.DNSRule
- func (b *BuildConfig) GetDnsRules() map[string]*option.DNSRule
- func (b *BuildConfig) GetDnsServer(tag string) (*option.DNSServerOptions, error)
- func (b *BuildConfig) GetDnsServers() map[string]*option.DNSServerOptions
- func (b *BuildConfig) GetInType(inname string) string
- func (b *BuildConfig) GetOutNames() []string
- func (b *BuildConfig) GetRouteRule(tag string) option.Rule
- func (b *BuildConfig) GetRouteRuleSet(tag string) (*option.RuleSet, error)
- func (b *BuildConfig) GetRouteRuleSetTags() []string
- func (b *BuildConfig) GetRouteRuleSets() map[string]*option.RuleSet
- func (b *BuildConfig) GetRouteRules() map[string]*option.Rule
- func (b *BuildConfig) GetSelector() *option.Outbound
- func (b *BuildConfig) OutType(tag string) string
- func (b *BuildConfig) RemoveCacehFile()
- func (b *BuildConfig) RemoveClashApi()
- func (b *BuildConfig) RemoveDnsRule(ruleTag string)
- func (b *BuildConfig) RemoveDnsServer(tag string) error
- func (b *BuildConfig) RemoveInbound(tagName string) error
- func (b *BuildConfig) RemoveOutbound(tagName string) error
- func (b *BuildConfig) RemoveRouteRule(tag string)
- func (b *BuildConfig) RemoveRouteRuleSet(tag string) error
- func (b *BuildConfig) RemoveSelector(tag string)
- func (b *BuildConfig) RemoveTls(tag string) error
- func (b *BuildConfig) SetDefaultDns(serverTag string) error
- func (b *BuildConfig) SetExportCallback(callback func(b []byte) any)
- func (b *BuildConfig) SetListToDnsRule(tagname, listname string, listable []string) error
- func (b *BuildConfig) SetListTorule(tagname, listname string, listable []string) error
- func (b *BuildConfig) SetRouteFinal(final string) error
- func (b *BuildConfig) SetRuleOutbound(tagname, outname string) error
- type ConfigStore
- func (c *ConfigStore) AllDnsRule() []DnsRule
- func (c *ConfigStore) AllDnsServer() []DnsServer
- func (c *ConfigStore) AllRUleSet() []RuleSet
- func (c *ConfigStore) AllRouteRulesWithReq() []RouteRule
- func (c *ConfigStore) Alloutbounds() []string
- func (c *ConfigStore) DefaultDns() option.DNSServerOptions
- func (c *ConfigStore) DnsRuleByname(name string) (option.DNSRule, error)
- func (c *ConfigStore) DnsRuleMust(tag string) DnsRule
- func (c *ConfigStore) DnsServerbyTag(tag string) (DnsServer, error)
- func (c *ConfigStore) FullDnsRuleByname(name string) (DnsRule, bool)
- func (c *ConfigStore) FullRuleByname(name string) (RouteRule, bool)
- func (c *ConfigStore) GetOutbound(refName string) (Outbound, error)
- func (c *ConfigStore) RouteRuleByname(name string) (option.Rule, error)
- func (c *ConfigStore) RuleSetBytag(tag string) (RuleSet, error)
- type DnsRule
- type DnsServer
- type OptionsEntry
- type Outbound
- type ReqirmentsOutbound
- type ReqirmentsRule
- type RouteRule
- type RuleSet
- type RuleSetter
- type StoreOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildConfig ¶
type BuildConfig struct {
Isnew bool
DefaultBuilt bool
DefaultDnsServerTag string
DefaultOutbound string
DefaultInbound string
//DnsOpt *option.DNSOptions
RouteOpt *option.RouteOptions
// contains filtered or unexported fields
}
func NewBuilder ¶
func NewBuilder(ctx context.Context, path string, store *ConfigStore, logger *zap.Logger) (*BuildConfig, error)
func (*BuildConfig) AddCacheFile ¶
func (b *BuildConfig) AddCacheFile() error
func (*BuildConfig) AddClashApi ¶
func (b *BuildConfig) AddClashApi() error
func (*BuildConfig) AddDnsRule ¶
func (b *BuildConfig) AddDnsRule(tagName string, server string) error
func (*BuildConfig) AddDnsRuleObj ¶
func (b *BuildConfig) AddDnsRuleObj(rule option.DNSRule) error
func (*BuildConfig) AddDnsServer ¶
func (b *BuildConfig) AddDnsServer(dnsServer option.DNSServerOptions) error
func (*BuildConfig) AddDnsServerRaw ¶
func (b *BuildConfig) AddDnsServerRaw(in []byte) error
func (*BuildConfig) AddExtranalOutbound ¶
func (b *BuildConfig) AddExtranalOutbound() error
get the outbound from user
func (*BuildConfig) AddInbound ¶
func (b *BuildConfig) AddInbound(preName string) error
Inbounds handling
func (*BuildConfig) AddOutbound ¶
this can add outbound via userconfig only support vless ws
func (*BuildConfig) AddRawRoute ¶
func (b *BuildConfig) AddRawRoute(in []byte, ref string) error
func (*BuildConfig) AddRouteRule ¶
func (b *BuildConfig) AddRouteRule(tagName string, outbound string) error
func (*BuildConfig) AddRouteRuleOb ¶
func (b *BuildConfig) AddRouteRuleOb(rule option.Rule) error
func (*BuildConfig) AddRouteRuleSet ¶
func (b *BuildConfig) AddRouteRuleSet(ruleset option.RuleSet) error
func (*BuildConfig) AddRouteRuleSetRaw ¶
func (b *BuildConfig) AddRouteRuleSetRaw(rulesetraw []byte) error
func (*BuildConfig) AddToSelector ¶
func (b *BuildConfig) AddToSelector(tag string)
func (*BuildConfig) AddoutJson ¶
func (b *BuildConfig) AddoutJson(bound []byte) error
func (*BuildConfig) BuildDefaultInbounds ¶
func (b *BuildConfig) BuildDefaultInbounds() error
func (*BuildConfig) BuildDefaultLog ¶
func (b *BuildConfig) BuildDefaultLog() error
func (*BuildConfig) BuildDefaultOutbound ¶
func (b *BuildConfig) BuildDefaultOutbound() error
Outbounds handling
func (*BuildConfig) BuildDefaultRoute ¶
func (b *BuildConfig) BuildDefaultRoute() error
Routing Handling
func (*BuildConfig) CacheFile ¶
func (b *BuildConfig) CacheFile() error
func (*BuildConfig) ChageTransport ¶
func (b *BuildConfig) ChageTransport(tag string, transport *option.V2RayTransportOptions) error
func (*BuildConfig) ChangeCache ¶
func (b *BuildConfig) ChangeCache(changer, val string) error
func (*BuildConfig) ChangeClash ¶
func (b *BuildConfig) ChangeClash(changer, val string) error
func (*BuildConfig) ChangeDialer ¶
func (b *BuildConfig) ChangeDialer(outname, changer, value string) error
func (*BuildConfig) ChangeDnsServerOpts ¶
func (b *BuildConfig) ChangeDnsServerOpts(tag, changer, val string) error
func (*BuildConfig) ChangeInboundOption ¶
func (b *BuildConfig) ChangeInboundOption(inname, changer, value string) error
func (*BuildConfig) ChangeMultiplex ¶
func (b *BuildConfig) ChangeMultiplex(outname, changer, value string) error
func (*BuildConfig) ChangeRuleSet ¶
func (b *BuildConfig) ChangeRuleSet(rulesetatg, changer, val string) error
func (*BuildConfig) ChangeSelfInbound ¶
func (b *BuildConfig) ChangeSelfInbound(inname, changer, value string) error
func (*BuildConfig) ChangeSelfOutbound ¶
func (b *BuildConfig) ChangeSelfOutbound(outname, changer, value string) error
func (*BuildConfig) ChangeServer ¶
func (b *BuildConfig) ChangeServer(outname string, newserver string) error
func (*BuildConfig) ChangeSni ¶
func (b *BuildConfig) ChangeSni(outname string, newsni string) error
func (*BuildConfig) ChangeTLS ¶
func (b *BuildConfig) ChangeTLS(outname, changer, value string) error
func (*BuildConfig) ChangeTlsSettings ¶
func (b *BuildConfig) ChangeTlsSettings(tag string, Tls *option.OutboundTLSOptions) error
func (*BuildConfig) ChangeTransport ¶
func (b *BuildConfig) ChangeTransport(outname, changer, value string) error
func (*BuildConfig) ChangeUUID ¶
func (b *BuildConfig) ChangeUUID(outname string, newuuid string) error
func (*BuildConfig) CheckDnsRule ¶
func (b *BuildConfig) CheckDnsRule(tag string) bool
func (*BuildConfig) CheckDnsServer ¶
func (b *BuildConfig) CheckDnsServer(tag string) bool
func (*BuildConfig) CheckOutbound ¶
func (b *BuildConfig) CheckOutbound(tag string) bool
func (*BuildConfig) CheckRule ¶
func (b *BuildConfig) CheckRule(tag string) bool
func (*BuildConfig) CheckRuleSet ¶
func (b *BuildConfig) CheckRuleSet(tag string) bool
func (*BuildConfig) Close ¶
func (b *BuildConfig) Close() error
func (*BuildConfig) DnsClient ¶
func (b *BuildConfig) DnsClient() error
func (*BuildConfig) Export ¶
func (b *BuildConfig) Export() any
func (*BuildConfig) ExportAllInbounds ¶
func (b *BuildConfig) ExportAllInbounds() any
func (*BuildConfig) ExportAllOutbounds ¶
func (b *BuildConfig) ExportAllOutbounds() any
func (*BuildConfig) ExportDns ¶
func (b *BuildConfig) ExportDns() any
func (*BuildConfig) ExportDnsRule ¶
func (b *BuildConfig) ExportDnsRule(tag string) any
func (*BuildConfig) ExportDnsServer ¶
func (b *BuildConfig) ExportDnsServer(tag string) any
func (*BuildConfig) ExportExpermental ¶
func (b *BuildConfig) ExportExpermental() any
func (*BuildConfig) ExportInbound ¶
func (b *BuildConfig) ExportInbound(tag string) any
func (*BuildConfig) ExportOutbound ¶
func (b *BuildConfig) ExportOutbound(tag string) any
func (*BuildConfig) ExportRoute ¶
func (b *BuildConfig) ExportRoute() any
func (*BuildConfig) ExportRouteRule ¶
func (b *BuildConfig) ExportRouteRule(tag string) any
func (*BuildConfig) ExportRuleSet ¶
func (b *BuildConfig) ExportRuleSet(tag string) any
func (*BuildConfig) GetAllInNames ¶
func (b *BuildConfig) GetAllInNames() []string
func (*BuildConfig) GetAllOutNames ¶
func (b *BuildConfig) GetAllOutNames() []string
func (*BuildConfig) GetDnsRule ¶
func (b *BuildConfig) GetDnsRule(tag string) option.DNSRule
func (*BuildConfig) GetDnsRules ¶
func (b *BuildConfig) GetDnsRules() map[string]*option.DNSRule
func (*BuildConfig) GetDnsServer ¶
func (b *BuildConfig) GetDnsServer(tag string) (*option.DNSServerOptions, error)
func (*BuildConfig) GetDnsServers ¶
func (b *BuildConfig) GetDnsServers() map[string]*option.DNSServerOptions
func (*BuildConfig) GetInType ¶
func (b *BuildConfig) GetInType(inname string) string
func (*BuildConfig) GetOutNames ¶
func (b *BuildConfig) GetOutNames() []string
func (*BuildConfig) GetRouteRule ¶
func (b *BuildConfig) GetRouteRule(tag string) option.Rule
func (*BuildConfig) GetRouteRuleSet ¶
func (b *BuildConfig) GetRouteRuleSet(tag string) (*option.RuleSet, error)
func (*BuildConfig) GetRouteRuleSetTags ¶
func (b *BuildConfig) GetRouteRuleSetTags() []string
func (*BuildConfig) GetRouteRuleSets ¶
func (b *BuildConfig) GetRouteRuleSets() map[string]*option.RuleSet
func (*BuildConfig) GetRouteRules ¶
func (b *BuildConfig) GetRouteRules() map[string]*option.Rule
func (*BuildConfig) GetSelector ¶
func (b *BuildConfig) GetSelector() *option.Outbound
func (*BuildConfig) OutType ¶
func (b *BuildConfig) OutType(tag string) string
func (*BuildConfig) RemoveCacehFile ¶
func (b *BuildConfig) RemoveCacehFile()
func (*BuildConfig) RemoveClashApi ¶
func (b *BuildConfig) RemoveClashApi()
func (*BuildConfig) RemoveDnsRule ¶
func (b *BuildConfig) RemoveDnsRule(ruleTag string)
func (*BuildConfig) RemoveDnsServer ¶
func (b *BuildConfig) RemoveDnsServer(tag string) error
func (*BuildConfig) RemoveInbound ¶
func (b *BuildConfig) RemoveInbound(tagName string) error
func (*BuildConfig) RemoveOutbound ¶
func (b *BuildConfig) RemoveOutbound(tagName string) error
func (*BuildConfig) RemoveRouteRule ¶
func (b *BuildConfig) RemoveRouteRule(tag string)
should update fetched rules again after
func (*BuildConfig) RemoveRouteRuleSet ¶
func (b *BuildConfig) RemoveRouteRuleSet(tag string) error
func (*BuildConfig) RemoveSelector ¶
func (b *BuildConfig) RemoveSelector(tag string)
func (*BuildConfig) RemoveTls ¶
func (b *BuildConfig) RemoveTls(tag string) error
func (*BuildConfig) SetDefaultDns ¶
func (b *BuildConfig) SetDefaultDns(serverTag string) error
func (*BuildConfig) SetExportCallback ¶
func (b *BuildConfig) SetExportCallback(callback func(b []byte) any)
func (*BuildConfig) SetListToDnsRule ¶
func (b *BuildConfig) SetListToDnsRule(tagname, listname string, listable []string) error
func (*BuildConfig) SetListTorule ¶
func (b *BuildConfig) SetListTorule(tagname, listname string, listable []string) error
func (*BuildConfig) SetRouteFinal ¶
func (b *BuildConfig) SetRouteFinal(final string) error
func (*BuildConfig) SetRuleOutbound ¶
func (b *BuildConfig) SetRuleOutbound(tagname, outname string) error
type ConfigStore ¶
type ConfigStore struct {
DnsRuleTags []string
RouteRuleTags []string
DnsServerTags []string
// contains filtered or unexported fields
}
Main config store object
func NewConfStore ¶
func NewConfStore(path string) (*ConfigStore, error)
func (*ConfigStore) AllDnsRule ¶
func (c *ConfigStore) AllDnsRule() []DnsRule
func (*ConfigStore) AllDnsServer ¶
func (c *ConfigStore) AllDnsServer() []DnsServer
func (*ConfigStore) AllRUleSet ¶
func (c *ConfigStore) AllRUleSet() []RuleSet
func (*ConfigStore) AllRouteRulesWithReq ¶
func (c *ConfigStore) AllRouteRulesWithReq() []RouteRule
return all rules with requrments
func (*ConfigStore) Alloutbounds ¶
func (c *ConfigStore) Alloutbounds() []string
func (*ConfigStore) DefaultDns ¶
func (c *ConfigStore) DefaultDns() option.DNSServerOptions
func (*ConfigStore) DnsRuleByname ¶
func (c *ConfigStore) DnsRuleByname(name string) (option.DNSRule, error)
func (*ConfigStore) DnsRuleMust ¶
func (c *ConfigStore) DnsRuleMust(tag string) DnsRule
func (*ConfigStore) DnsServerbyTag ¶
func (c *ConfigStore) DnsServerbyTag(tag string) (DnsServer, error)
func (*ConfigStore) FullDnsRuleByname ¶
func (c *ConfigStore) FullDnsRuleByname(name string) (DnsRule, bool)
func (*ConfigStore) FullRuleByname ¶
func (c *ConfigStore) FullRuleByname(name string) (RouteRule, bool)
func (*ConfigStore) GetOutbound ¶
func (c *ConfigStore) GetOutbound(refName string) (Outbound, error)
func (*ConfigStore) RouteRuleByname ¶
func (c *ConfigStore) RouteRuleByname(name string) (option.Rule, error)
func (*ConfigStore) RuleSetBytag ¶
func (c *ConfigStore) RuleSetBytag(tag string) (RuleSet, error)
type DnsRule ¶
type DnsRule struct {
Rule option.DNSRule `json:"rule,omitempty"`
Info string `json:"info,omitempty"`
Reqirments ReqirmentsRule `json:"reqirments,omitempty"`
}
type DnsServer ¶
type DnsServer struct {
Server option.DNSServerOptions `json:"server,omitempty"`
Info string `json:"info,omitempty"`
}
type OptionsEntry ¶
type OptionsEntry struct {
// contains filtered or unexported fields
}
copied struct from sing box
type Outbound ¶
type Outbound struct {
Out option.Outbound `json:"out,omitempty"`
Info string `json:"info,omitempty"`
Reqirments ReqirmentsOutbound `json:"reqirments,omitempty"`
Price int64 `json:"price,omitempty"` //TODO: may be later
}
type ReqirmentsOutbound ¶
type ReqirmentsOutbound struct {
NeedUUID bool `json:"uuid,omitempty"`
NeedServer bool `json:"server,omitempty"`
NeedPort bool `json:"port,omitempty"`
NeedSni bool `json:"server_name,omitempty"`
NeedTag bool `json:"tag,omitempty"`
NeedTransportHost bool `json:"transporthost,omitempty"`
}
common requrments for all outbounds common
type ReqirmentsRule ¶
type ReqirmentsRule struct {
IsStatic bool `json:"static,omitempty"`
NeedPort bool `json:"needport,omitempty"`
NeedPortRange bool `json:"needportRange,omitempty"`
NeedDomain bool `json:"needdomain,omitempty"`
NeedProtocole bool `json:"needprotocole,omitempty"`
NeedIp_cidr bool `json:"needip_cidr,omitempty"`
NeedRuleSet bool `json:"needruleSet,omitempty"`
NeedToChangeOut bool `json:"changeout,omitempty"`
}
func (*ReqirmentsRule) FillReqirments ¶
func (r *ReqirmentsRule) FillReqirments(callback common.Callbackreciver, sendreciver common.Sendreciver, ruleany any) error
callback reciver should support even msgs without buttons
type RouteRule ¶
type RouteRule struct {
Rule option.Rule `json:"rule,omitempty"`
Info string `json:"info,omitempty"` // info about rule object
Reqirments ReqirmentsRule `json:"reqirments,omitempty"`
}
type RuleSetter ¶
type StoreOption ¶
Click to show internal directories.
Click to hide internal directories.