Documentation ¶
Index ¶
- Constants
- Variables
- func Valid(proxyType ProxyType) bool
- type AverageSpeedDS
- type GeoInfo
- type HTTPPingDS
- type IPStacks
- type InboundGeoIPDS
- type InvalidDS
- type MacroFieldType
- type MatrixResponse
- type MaxSpeedDS
- type MultiStacks
- func (tms *MultiStacks) Count() int
- func (tms *MultiStacks) First(tag string) *GeoInfo
- func (tms *MultiStacks) FirstV2(tag string) *GeoInfo
- func (tms *MultiStacks) ForEach(assignedMain *GeoInfo) map[int][]*GeoInfo
- func (tms *MultiStacks) Repr() string
- func (tms *MultiStacks) V46StackCount() (int, int)
- func (tms *MultiStacks) V46StackInfo() string
- type OutboundGeoIPDS
- type PerSecondSpeedDS
- type ProxyInfo
- type ProxyType
- type RTTPingDS
- type RequestOptions
- type RequestOptionsNetwork
- type Script
- type ScriptResult
- type ScriptTestDS
- type ScriptType
- type SlaveEntrySlot
- type SlaveProgress
- type SlaveRequest
- type SlaveRequestBasics
- type SlaveRequestConfigs
- type SlaveRequestMacro
- type SlaveRequestMacroType
- type SlaveRequestMatrix
- type SlaveRequestMatrixEntry
- type SlaveRequestMatrixType
- type SlaveRequestNode
- type SlaveRequestOptions
- type SlaveResponse
- type SlaveTask
- type UDPTypeDS
- type Vendor
- type VendorStatus
- type VendorType
Constants ¶
View Source
const ( MFTPingRTT = "PingRTT" MFTPingRequest = "PingRequest" MFTNATType = "NATType" )
Variables ¶
View Source
var AllProxyTypes = []ProxyType{ Shadowsocks, ShadowsocksR, Snell, Socks5, Http, Vmess, Trojan, Vless, Hysteria, Hysteria2, Tuic, }
Functions ¶
Types ¶
type AverageSpeedDS ¶
type AverageSpeedDS struct {
Value uint64
}
type GeoInfo ¶
type GeoInfo struct { Org string `json:"organization"` Lon float32 `json:"longitude"` Lat float32 `json:"latitude"` TimeZone string `json:"timezone"` ISP string `json:"isp"` ASN int `json:"asn"` ASNOrg string `json:"asn_organization"` Country string `json:"country"` IP string `json:"ip"` ContinentCode string `json:"continent_code"` CountryCode string `json:"country_code"` StackType string `json:"stackType"` }
type HTTPPingDS ¶
type HTTPPingDS struct {
Value uint16
}
type InboundGeoIPDS ¶
type InboundGeoIPDS struct {
MultiStacks
}
type MacroFieldType ¶
type MacroFieldType string
type MatrixResponse ¶
type MatrixResponse struct { Type SlaveRequestMatrixType Payload string }
type MaxSpeedDS ¶
type MaxSpeedDS struct {
Value uint64
}
type MultiStacks ¶
type MultiStacks struct { Domain string // 域组,作为 In 时为域名,Out 时则为线路本身 MainStack *GeoInfo // deprecating IPv4Stack []*GeoInfo IPv6Stack []*GeoInfo }
func (*MultiStacks) Count ¶
func (tms *MultiStacks) Count() int
func (*MultiStacks) First ¶
func (tms *MultiStacks) First(tag string) *GeoInfo
func (*MultiStacks) FirstV2 ¶
func (tms *MultiStacks) FirstV2(tag string) *GeoInfo
func (*MultiStacks) ForEach ¶
func (tms *MultiStacks) ForEach(assignedMain *GeoInfo) map[int][]*GeoInfo
func (*MultiStacks) Repr ¶
func (tms *MultiStacks) Repr() string
func (*MultiStacks) V46StackCount ¶
func (tms *MultiStacks) V46StackCount() (int, int)
func (*MultiStacks) V46StackInfo ¶
func (tms *MultiStacks) V46StackInfo() string
type OutboundGeoIPDS ¶
type OutboundGeoIPDS struct {
MultiStacks
}
type PerSecondSpeedDS ¶
type ProxyType ¶
type ProxyType string
const ( Shadowsocks ProxyType = "Shadowsocks" ShadowsocksR ProxyType = "ShadowsocksR" Snell ProxyType = "Snell" Socks5 ProxyType = "Socks5" Http ProxyType = "Http" Vmess ProxyType = "Vmess" Trojan ProxyType = "Trojan" Vless ProxyType = "Vless" Hysteria ProxyType = "Hysteria" Hysteria2 ProxyType = "Hysteria2" Tuic ProxyType = "Tuic" ProxyInvalid ProxyType = "Invalid" )
type RequestOptions ¶
type RequestOptionsNetwork ¶
type RequestOptionsNetwork string
const ( ROptionsTCP RequestOptionsNetwork = "tcp" ROptionsTCP6 RequestOptionsNetwork = "tcp6" )
func (*RequestOptionsNetwork) String ¶
func (ron *RequestOptionsNetwork) String() string
type Script ¶
type Script struct { ID string `yaml:"-" fw:"readonly"` Type ScriptType `yaml:"type"` Content string `yaml:"content"` TimeoutMillis uint64 `yaml:"timeout,omitempty"` }
type ScriptResult ¶
func (*ScriptResult) Clone ¶
func (sr *ScriptResult) Clone() *ScriptResult
type ScriptTestDS ¶
type ScriptTestDS struct { Key string ScriptResult }
type ScriptType ¶
type ScriptType string
const ( STypeMedia ScriptType = "media" STypeIP ScriptType = "ip" )
type SlaveEntrySlot ¶
type SlaveEntrySlot struct { Grouping string ProxyInfo ProxyInfo InvokeDuration int64 Matrices []MatrixResponse }
func (*SlaveEntrySlot) Get ¶
func (ses *SlaveEntrySlot) Get(idx int) *MatrixResponse
type SlaveProgress ¶
type SlaveProgress struct { Index int Record SlaveEntrySlot Queuing int }
type SlaveRequest ¶
type SlaveRequest struct { Basics SlaveRequestBasics Options SlaveRequestOptions Configs SlaveRequestConfigs Vendor VendorType Nodes []SlaveRequestNode RandomSequence string Challenge string }
func (*SlaveRequest) Clone ¶
func (sr *SlaveRequest) Clone() *SlaveRequest
type SlaveRequestBasics ¶
type SlaveRequestBasics struct { ID string Slave string SlaveName string Invoker string Version string }
func (*SlaveRequestBasics) Clone ¶
func (srb *SlaveRequestBasics) Clone() *SlaveRequestBasics
type SlaveRequestConfigs ¶
type SlaveRequestConfigs struct { STUNURL string `yaml:"stunURL,omitempty" cf:"name=🫙 STUN 地址"` DownloadURL string `yaml:"downloadURL,omitempty" cf:"name=📃 测速文件"` DownloadDuration int64 `yaml:"downloadDuration,omitempty" cf:"name=⏱️ 测速时长 (单位: 秒)"` DownloadThreading uint `yaml:"downloadThreading,omitempty" cf:"name=🧶 测速线程数"` PingAverageOver uint16 `yaml:"pingAverageOver,omitempty" cf:"name=🧮 多次 Ping 求均值,value"` PingAddress string `yaml:"pingAddress,omitempty" cf:"name=🏫 URL Ping 地址"` TaskRetry uint `yaml:"taskRetry,omitempty" cf:"name=🐛 测试重试次数"` DNSServers []string `yaml:"dnsServers,omitempty" cf:"name=💾 自定义DNS服务器,childvalue"` TaskTimeout uint `yaml:"-" fw:"readonly"` Scripts []Script `yaml:"-" fw:"readonly"` }
func (*SlaveRequestConfigs) Check ¶
func (cfg *SlaveRequestConfigs) Check() *SlaveRequestConfigs
func (*SlaveRequestConfigs) Clone ¶
func (src *SlaveRequestConfigs) Clone() *SlaveRequestConfigs
func (*SlaveRequestConfigs) DescriptionText ¶
func (src *SlaveRequestConfigs) DescriptionText() string
func (*SlaveRequestConfigs) Merge ¶
func (src *SlaveRequestConfigs) Merge(from *SlaveRequestConfigs) *SlaveRequestConfigs
type SlaveRequestMacro ¶
type SlaveRequestMacro interface { // define the macro type to match Type() SlaveRequestMacroType // define the task for the macro, Run(proxy Vendor, request *SlaveRequest) error }
Macro is the atom runner for a job. Since some matrices could be combined, e.g. HTTPPing / RTTPing, so instead of triggering two similar jobs, we only run a macro job once and return attributes for multiple matrices
type SlaveRequestMacroType ¶
type SlaveRequestMacroType string
const ( MacroSpeed SlaveRequestMacroType = "SPEED" MacroPing SlaveRequestMacroType = "PING" MacroUDP SlaveRequestMacroType = "UDP" MacroScript SlaveRequestMacroType = "SCRIPT" MacroGeo SlaveRequestMacroType = "GEO" MacroInvalid SlaveRequestMacroType = "INVALID" )
type SlaveRequestMatrix ¶
type SlaveRequestMatrix interface { // define the matrix type to match Type() SlaveRequestMatrixType // define which macro job to run MacroJob() SlaveRequestMacroType // define the function to extract attribute // from macro result Extract(SlaveRequestMatrixEntry, SlaveRequestMacro) }
Matrix is the the atom attribute for a job e.g. to fetch the RTTPing of a node, it calls RTTPing matrix, which would initiate a ping macro and return the RTTPing attribute
type SlaveRequestMatrixEntry ¶
type SlaveRequestMatrixEntry struct { Type SlaveRequestMatrixType Params string }
type SlaveRequestMatrixType ¶
type SlaveRequestMatrixType string
const ( MatrixAverageSpeed SlaveRequestMatrixType = "SPEED_AVERAGE" MatrixMaxSpeed SlaveRequestMatrixType = "SPEED_MAX" MatrixPerSecondSpeed SlaveRequestMatrixType = "SPEED_PER_SECOND" MatrixUDPType SlaveRequestMatrixType = "UDP_TYPE" MatrixInboundGeoIP SlaveRequestMatrixType = "GEOIP_INBOUND" MatrixOutboundGeoIP SlaveRequestMatrixType = "GEOIP_OUTBOUND" MatrixScriptTest SlaveRequestMatrixType = "TEST_SCRIPT" MatrixHTTPPing SlaveRequestMatrixType = "TEST_PING_CONN" MatrixRTTPing SlaveRequestMatrixType = "TEST_PING_RTT" MatrixInvalid SlaveRequestMatrixType = "INVALID" )
func (*SlaveRequestMatrixType) Valid ¶
func (srmt *SlaveRequestMatrixType) Valid() bool
type SlaveRequestNode ¶
func (*SlaveRequestNode) Clone ¶
func (srn *SlaveRequestNode) Clone() *SlaveRequestNode
type SlaveRequestOptions ¶
type SlaveRequestOptions struct { Filter string Matrices []SlaveRequestMatrixEntry }
func (*SlaveRequestOptions) Clone ¶
func (sro *SlaveRequestOptions) Clone() *SlaveRequestOptions
type SlaveResponse ¶
type SlaveResponse struct { ID string MiaoSpeedVersion string Error string Result *SlaveTask Progress *SlaveProgress }
type SlaveTask ¶
type SlaveTask struct { Request SlaveRequest Results []SlaveEntrySlot }
type Vendor ¶
type Vendor interface { // returns the type of the vendor Type() VendorType // returns the status of the vendor Status() VendorStatus // build conn based on proxy info string Build(proxyName string, proxyInfo string) Vendor // tcp connections DialTCP(ctx context.Context, url string, network RequestOptionsNetwork) (net.Conn, error) // udp connections DialUDP(ctx context.Context, url string) (net.PacketConn, error) // return universal proxy info ProxyInfo() ProxyInfo }
a Vendor is an interface that allow macros to trigger connections from
type VendorStatus ¶
type VendorStatus uint
const ( VStatusOperational VendorStatus = iota VStatusNotReady )
type VendorType ¶
type VendorType string
const ( VendorLocal VendorType = "Local" VendorClash VendorType = "Clash" VendorInvalid VendorType = "Invalid" )
Click to show internal directories.
Click to hide internal directories.