Documentation
¶
Index ¶
- Variables
- func Base64Decode(s string) string
- func NewProxyDirect() constant.Proxy
- type AdapterCache
- func (p *AdapterCache) Del(key string)
- func (p *AdapterCache) Load(key string) (any, error)
- func (p *AdapterCache) LoadBool(key string) bool
- func (p *AdapterCache) LoadFloat64(key string) float64
- func (p *AdapterCache) LoadUint16(key string) uint16
- func (p *AdapterCache) Reset()
- func (p *AdapterCache) Store(key string, val any)
- type AdapterProxy
- type AdapterType
- type Cache
- type DisneyUnlockInfo
- type ExtraInfo
- func (p *ExtraInfo) GenNameTpl() string
- func (p *ExtraInfo) GetDisneyUnlock() *DisneyUnlockInfo
- func (p *ExtraInfo) GetDownloadSpeed() *SpeedInfo
- func (p *ExtraInfo) GetGoogleDelay() time.Duration
- func (p *ExtraInfo) GetInBound() *IpInfo
- func (p *ExtraInfo) GetNetflixUnlock() *NetflixUnlockInfo
- func (p *ExtraInfo) GetOutIpv4() *IpInfo
- func (p *ExtraInfo) GetOutIpv6() *IpInfo
- func (p *ExtraInfo) GetUploadSpeed() *SpeedInfo
- func (p *ExtraInfo) GetYouTubeUnlock() *YoutubeUnlockInfo
- func (p *ExtraInfo) SetDisneyUnlock(s *DisneyUnlockInfo)
- func (p *ExtraInfo) SetDownloadSpeed(s *SpeedInfo)
- func (p *ExtraInfo) SetGoogleDelay(d time.Duration)
- func (p *ExtraInfo) SetInBound(s *IpInfo)
- func (p *ExtraInfo) SetNetflixUnlock(s *NetflixUnlockInfo)
- func (p *ExtraInfo) SetOutIpv4(s *IpInfo)
- func (p *ExtraInfo) SetOutIpv6(s *IpInfo)
- func (p *ExtraInfo) SetUploadSpeed(s *SpeedInfo)
- func (p *ExtraInfo) SetYouTubeUnlock(s *YoutubeUnlockInfo)
- type IpInfo
- type MITM
- type NetflixUnlockInfo
- type ProxyAdapter
- func NewProxyAdapter(adapter constant.Proxy, opt any) (*ProxyAdapter, error)
- func ParseClash(m map[string]any) (*ProxyAdapter, error)
- func ParseClashJson(s []byte) (*ProxyAdapter, error)
- func ParseClashYaml(s []byte) (*ProxyAdapter, error)
- func ParseLinkHttp(s string) (*ProxyAdapter, error)
- func ParseLinkNico(s string) (*ProxyAdapter, error)
- func ParseLinkSS(s string) (*ProxyAdapter, error)
- func ParseLinkSSR(s string) (*ProxyAdapter, error)
- func ParseLinkSocket5(s string) (*ProxyAdapter, error)
- func ParseLinkTrojan(s string) (*ProxyAdapter, error)
- func ParseLinkVmess(s string) (*ProxyAdapter, error)
- func ParseV2ray(s string) (*ProxyAdapter, error)
- func (p *ProxyAdapter) CheckInBound() *IpInfo
- func (p *ProxyAdapter) CheckIpv4() *IpInfo
- func (p *ProxyAdapter) CheckIpv6() *IpInfo
- func (p *ProxyAdapter) Clone() *ProxyAdapter
- func (p *ProxyAdapter) DisneyUnlockTest()
- func (p *ProxyAdapter) DoRequest(method, rawUrl string, body io.Reader, timeout time.Duration, ...) error
- func (p *ProxyAdapter) DownloadSpeedTest(max int) (int64, error)
- func (p *ProxyAdapter) GenDialContext(u *url.URL) (constant.Conn, error)
- func (p *ProxyAdapter) Get(url string, timeout time.Duration, headers map[string]string) ([]byte, error)
- func (p *ProxyAdapter) GetClient() *http.Client
- func (p *ProxyAdapter) GetTicker() *TotalTracker
- func (p *ProxyAdapter) GetTotalDownload() uint64
- func (p *ProxyAdapter) GetTotalUpload() uint64
- func (p *ProxyAdapter) GoogleTest() (time.Duration, error)
- func (p *ProxyAdapter) HostName() string
- func (p *ProxyAdapter) Name() string
- func (p *ProxyAdapter) NetflixUnlockTest()
- func (p *ProxyAdapter) Port() string
- func (p *ProxyAdapter) RegisterTotalTracker(tracker Tracker) *ProxyAdapter
- func (p *ProxyAdapter) Security() string
- func (p *ProxyAdapter) SetName(name string) *ProxyAdapter
- func (p *ProxyAdapter) Sub4Clash() string
- func (p *ProxyAdapter) Sub4Nico() string
- func (p *ProxyAdapter) Sub4V2ray() string
- func (p *ProxyAdapter) ToClash() map[string]any
- func (p *ProxyAdapter) ToNico() map[string]any
- func (p *ProxyAdapter) ToNicoLink() string
- func (p *ProxyAdapter) UniqueId() string
- func (p *ProxyAdapter) UniqueIdShort() string
- func (p *ProxyAdapter) UploadSpeedTest(max int) (int64, error)
- func (p *ProxyAdapter) YoutubeUnlockTest()
- type ProxyDirect
- func (p *ProxyDirect) Alive() bool
- func (p *ProxyDirect) DelayHistory() []constant.DelayHistory
- func (p *ProxyDirect) Dial(metadata *constant.Metadata) (constant.Conn, error)
- func (p *ProxyDirect) DialUDP(metadata *constant.Metadata) (constant.PacketConn, error)
- func (p *ProxyDirect) Health() float64
- func (p *ProxyDirect) HealthCheck(ctx context.Context)
- func (p *ProxyDirect) LastDelay() uint16
- func (p *ProxyDirect) LastSpeed() int64
- func (p *ProxyDirect) URLTest(ctx context.Context, url string) (uint16, error)
- type ProxyList
- func (ss ProxyList) All(fn func(value AdapterProxy) bool) bool
- func (ss ProxyList) Any(fn func(value AdapterProxy) bool) bool
- func (ss ProxyList) Append(elements ...AdapterProxy) ProxyList
- func (ss ProxyList) Bottom(n int) (top ProxyList)
- func (ss ProxyList) Contains(lookingFor AdapterProxy) bool
- func (ss ProxyList) Diff(against ProxyList) (added, removed ProxyList)
- func (ss ProxyList) DropTop(n int) (drop ProxyList)
- func (ss ProxyList) DropWhile(f func(s AdapterProxy) bool) (ss2 ProxyList)
- func (ss ProxyList) Each(fn func(AdapterProxy)) ProxyList
- func (ss ProxyList) Equals(rhs ProxyList) bool
- func (ss ProxyList) Extend(slices ...ProxyList) (ss2 ProxyList)
- func (ss ProxyList) Filter(condition func(AdapterProxy) bool) (ss2 ProxyList)
- func (ss ProxyList) FilterNot(condition func(AdapterProxy) bool) (ss2 ProxyList)
- func (ss ProxyList) FindFirstUsing(fn func(value AdapterProxy) bool) int
- func (ss ProxyList) First() AdapterProxy
- func (ss ProxyList) FirstOr(defaultValue AdapterProxy) AdapterProxy
- func (ss ProxyList) Float64s() pie.Float64s
- func (ss ProxyList) Insert(index int, values ...AdapterProxy) ProxyList
- func (ss ProxyList) Ints() pie.Ints
- func (ss ProxyList) JSONBytes() []byte
- func (ss ProxyList) JSONBytesIndent(prefix, indent string) []byte
- func (ss ProxyList) JSONString() string
- func (ss ProxyList) JSONStringIndent(prefix, indent string) string
- func (ss ProxyList) Join(glue string) (s string)
- func (ss ProxyList) Last() AdapterProxy
- func (ss ProxyList) LastOr(defaultValue AdapterProxy) AdapterProxy
- func (ss ProxyList) Len() int
- func (ss ProxyList) Map(fn func(AdapterProxy) AdapterProxy) (ss2 ProxyList)
- func (ss ProxyList) Mode() ProxyList
- func (ss *ProxyList) Pop() (popped *AdapterProxy)
- func (ss ProxyList) Random(source rand.Source) AdapterProxy
- func (ss ProxyList) Reverse() ProxyList
- func (ss ProxyList) Send(ctx context.Context, ch chan<- AdapterProxy) ProxyList
- func (ss ProxyList) SequenceUsing(creator func(int) AdapterProxy, params ...int) ProxyList
- func (ss ProxyList) Shift() (AdapterProxy, ProxyList)
- func (ss ProxyList) Shuffle(source rand.Source) ProxyList
- func (ss ProxyList) SortStableUsing(less func(a, b AdapterProxy) bool) ProxyList
- func (ss ProxyList) SortUsing(less func(a, b AdapterProxy) bool) ProxyList
- func (ss ProxyList) Strings() pie.Strings
- func (ss ProxyList) StringsUsing(transform func(AdapterProxy) string) pie.Strings
- func (ss ProxyList) SubSlice(start int, end int) (subSlice ProxyList)
- func (ss ProxyList) Top(n int) (top ProxyList)
- func (ss ProxyList) Unshift(elements ...AdapterProxy) (unshift ProxyList)
- type Rule
- type RuleInfo
- type RuleType
- type SpeedInfo
- type TotalTracker
- type Tracker
- type YoutubeUnlockInfo
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnsupportedType = errors.New("unsupported type") ErrEmptyDate = errors.New("empty date") )
var (
ErrCacheNotFound = errors.New("cache not found")
)
Functions ¶
func Base64Decode ¶
func NewProxyDirect ¶
Types ¶
type AdapterCache ¶
type AdapterCache struct {
// contains filtered or unexported fields
}
func (*AdapterCache) Del ¶
func (p *AdapterCache) Del(key string)
func (*AdapterCache) LoadBool ¶
func (p *AdapterCache) LoadBool(key string) bool
func (*AdapterCache) LoadFloat64 ¶
func (p *AdapterCache) LoadFloat64(key string) float64
func (*AdapterCache) LoadUint16 ¶
func (p *AdapterCache) LoadUint16(key string) uint16
func (*AdapterCache) Reset ¶
func (p *AdapterCache) Reset()
func (*AdapterCache) Store ¶
func (p *AdapterCache) Store(key string, val any)
type AdapterProxy ¶
type AdapterProxy interface { constant.Proxy Cache HostName() string Port() string Sub4Nico() string Sub4Clash() string Sub4V2ray() string ToNico() map[string]any UniqueId() string UniqueIdShort() string GenDialContext(u *url.URL) (constant.Conn, error) GetClient() *http.Client DoRequest(method, rawUrl string, body io.Reader, timeout time.Duration, headers map[string]string, logic func(resp *http.Response, start time.Time) error) error Get(url string, timeout time.Duration, headers map[string]string) ([]byte, error) GetTotalUpload() uint64 GetTotalDownload() uint64 }
type AdapterType ¶
type AdapterType int
const ( Direct AdapterType = iota Reject Proxy )
func CoverAdapterType ¶
func CoverAdapterType(at constant.AdapterType) AdapterType
func ParseAdapterType ¶
func ParseAdapterType(at string) AdapterType
func (AdapterType) String ¶
func (at AdapterType) String() string
type Cache ¶
type Cache interface { Reset() Store(key string, val any) Load(key string) (val any, err error) LoadBool(key string) bool LoadUint16(key string) uint16 LoadFloat64(key string) float64 Del(key string) }
func NewAdapterCache ¶
func NewAdapterCache() Cache
type DisneyUnlockInfo ¶
type DisneyUnlockInfo struct { Unlocked bool `json:"unlocked,omitempty"` Region string `json:"region,omitempty"` }
func (DisneyUnlockInfo) String ¶
func (p DisneyUnlockInfo) String() string
type ExtraInfo ¶
type ExtraInfo struct { Country string `json:"country,omitempty"` Region string `json:"region,omitempty"` City string `json:"city,omitempty"` CountryCode string `json:"country_code,omitempty"` CountryEmoji string `json:"country_emoji,omitempty"` Delay time.Duration `json:"delay,omitempty"` /* -1 无法访问 -2 被重定向 -3 读取包失败 */ GoogleDelay time.Duration `json:"google,omitempty"` DownloadSpeed *SpeedInfo `json:"download_speed,omitempty"` UploadSpeed *SpeedInfo `json:"upload_speed,omitempty"` NetflixUnlock *NetflixUnlockInfo `json:"netflix_unlock,omitempty"` DisneyUnlock *DisneyUnlockInfo `json:"disney_unlock,omitempty"` YoutubeUnlock *YoutubeUnlockInfo `json:"youtube_unlock,omitempty"` InBound *IpInfo `json:"in_bound,omitempty"` OutIpv4 *IpInfo `json:"out_ipv4,omitempty"` OutIpv6 *IpInfo `json:"out_ipv6,omitempty"` // contains filtered or unexported fields }
func ParseClash4Extra ¶
func (*ExtraInfo) GenNameTpl ¶
CountryEmoji Country-Region-City Name
func (*ExtraInfo) GetDisneyUnlock ¶
func (p *ExtraInfo) GetDisneyUnlock() *DisneyUnlockInfo
func (*ExtraInfo) GetDownloadSpeed ¶
func (*ExtraInfo) GetGoogleDelay ¶
func (*ExtraInfo) GetInBound ¶
func (*ExtraInfo) GetNetflixUnlock ¶
func (p *ExtraInfo) GetNetflixUnlock() *NetflixUnlockInfo
func (*ExtraInfo) GetOutIpv4 ¶
func (*ExtraInfo) GetOutIpv6 ¶
func (*ExtraInfo) GetUploadSpeed ¶
func (*ExtraInfo) GetYouTubeUnlock ¶
func (p *ExtraInfo) GetYouTubeUnlock() *YoutubeUnlockInfo
func (*ExtraInfo) SetDisneyUnlock ¶
func (p *ExtraInfo) SetDisneyUnlock(s *DisneyUnlockInfo)
func (*ExtraInfo) SetDownloadSpeed ¶
func (*ExtraInfo) SetGoogleDelay ¶
func (*ExtraInfo) SetInBound ¶
func (*ExtraInfo) SetNetflixUnlock ¶
func (p *ExtraInfo) SetNetflixUnlock(s *NetflixUnlockInfo)
func (*ExtraInfo) SetOutIpv4 ¶
func (*ExtraInfo) SetOutIpv6 ¶
func (*ExtraInfo) SetUploadSpeed ¶
func (*ExtraInfo) SetYouTubeUnlock ¶
func (p *ExtraInfo) SetYouTubeUnlock(s *YoutubeUnlockInfo)
type IpInfo ¶
type IpInfo struct { Continent string `json:"continent,omitempty"` ContinentCode string `json:"continentCode,omitempty"` Country string `json:"country,omitempty"` CountryCode string `json:"countryCode,omitempty"` Region string `json:"region,omitempty"` RegionName string `json:"regionName,omitempty"` City string `json:"city,omitempty"` District string `json:"district,omitempty"` Zip string `json:"zip,omitempty"` Lat float64 `json:"lat,omitempty"` Lon float64 `json:"lon,omitempty"` Timezone string `json:"timezone,omitempty"` Offset int `json:"offset,omitempty"` Currency string `json:"currency,omitempty"` Isp string `json:"isp,omitempty"` Org string `json:"org,omitempty"` As string `json:"as.,omitempty"` Asname string `json:"asname,omitempty"` Reverse string `json:"reverse,omitempty"` Mobile bool `json:"mobile,omitempty"` Proxy bool `json:"proxy,omitempty"` Hosting bool `json:"hosting,omitempty"` Query string `json:"query,omitempty"` }
type NetflixUnlockInfo ¶
type NetflixUnlockInfo struct { // 自制剧解锁 SelfMadeUnlock bool `json:"self_made_unlock,omitempty"` // 非自制剧解锁 NonSelfMadeUnlock bool `json:"non_self_made_unlock,omitempty"` Region string `json:"region,omitempty"` MITM MITM `json:"mitm,omitempty"` }
func (NetflixUnlockInfo) GetCountryCode ¶
func (p NetflixUnlockInfo) GetCountryCode() string
func (NetflixUnlockInfo) String ¶
func (p NetflixUnlockInfo) String() string
type ProxyAdapter ¶
type ProxyAdapter struct { constant.Proxy Cache ExtraInfo // contains filtered or unexported fields }
func NewProxyAdapter ¶
func NewProxyAdapter(adapter constant.Proxy, opt any) (*ProxyAdapter, error)
func ParseClash ¶
func ParseClash(m map[string]any) (*ProxyAdapter, error)
func ParseClashJson ¶
func ParseClashJson(s []byte) (*ProxyAdapter, error)
func ParseClashYaml ¶
func ParseClashYaml(s []byte) (*ProxyAdapter, error)
func ParseLinkHttp ¶
func ParseLinkHttp(s string) (*ProxyAdapter, error)
func ParseLinkNico ¶
func ParseLinkNico(s string) (*ProxyAdapter, error)
func ParseLinkSS ¶
func ParseLinkSS(s string) (*ProxyAdapter, error)
func ParseLinkSSR ¶
func ParseLinkSSR(s string) (*ProxyAdapter, error)
func ParseLinkSocket5 ¶
func ParseLinkSocket5(s string) (*ProxyAdapter, error)
func ParseLinkTrojan ¶
func ParseLinkTrojan(s string) (*ProxyAdapter, error)
func ParseLinkVmess ¶
func ParseLinkVmess(s string) (*ProxyAdapter, error)
func ParseV2ray ¶
func ParseV2ray(s string) (*ProxyAdapter, error)
func (*ProxyAdapter) CheckInBound ¶
func (p *ProxyAdapter) CheckInBound() *IpInfo
func (*ProxyAdapter) CheckIpv4 ¶
func (p *ProxyAdapter) CheckIpv4() *IpInfo
func (*ProxyAdapter) CheckIpv6 ¶
func (p *ProxyAdapter) CheckIpv6() *IpInfo
func (*ProxyAdapter) Clone ¶
func (p *ProxyAdapter) Clone() *ProxyAdapter
func (*ProxyAdapter) DisneyUnlockTest ¶
func (p *ProxyAdapter) DisneyUnlockTest()
func (*ProxyAdapter) DownloadSpeedTest ¶
func (p *ProxyAdapter) DownloadSpeedTest(max int) (int64, error)
固定时间测试
func (*ProxyAdapter) GenDialContext ¶
func (*ProxyAdapter) GetClient ¶
func (p *ProxyAdapter) GetClient() *http.Client
func (*ProxyAdapter) GetTicker ¶
func (p *ProxyAdapter) GetTicker() *TotalTracker
func (*ProxyAdapter) GetTotalDownload ¶
func (p *ProxyAdapter) GetTotalDownload() uint64
func (*ProxyAdapter) GetTotalUpload ¶
func (p *ProxyAdapter) GetTotalUpload() uint64
func (*ProxyAdapter) GoogleTest ¶
func (p *ProxyAdapter) GoogleTest() (time.Duration, error)
func (*ProxyAdapter) HostName ¶
func (p *ProxyAdapter) HostName() string
func (*ProxyAdapter) Name ¶
func (p *ProxyAdapter) Name() string
func (*ProxyAdapter) NetflixUnlockTest ¶
func (p *ProxyAdapter) NetflixUnlockTest()
func (*ProxyAdapter) Port ¶
func (p *ProxyAdapter) Port() string
func (*ProxyAdapter) RegisterTotalTracker ¶
func (p *ProxyAdapter) RegisterTotalTracker(tracker Tracker) *ProxyAdapter
func (*ProxyAdapter) Security ¶
func (p *ProxyAdapter) Security() string
func (*ProxyAdapter) SetName ¶
func (p *ProxyAdapter) SetName(name string) *ProxyAdapter
func (*ProxyAdapter) Sub4Clash ¶
func (p *ProxyAdapter) Sub4Clash() string
func (*ProxyAdapter) Sub4Nico ¶
func (p *ProxyAdapter) Sub4Nico() string
func (*ProxyAdapter) Sub4V2ray ¶
func (p *ProxyAdapter) Sub4V2ray() string
func (*ProxyAdapter) ToClash ¶
func (p *ProxyAdapter) ToClash() map[string]any
func (*ProxyAdapter) ToNico ¶
func (p *ProxyAdapter) ToNico() map[string]any
func (*ProxyAdapter) ToNicoLink ¶
func (p *ProxyAdapter) ToNicoLink() string
func (*ProxyAdapter) UniqueId ¶
func (p *ProxyAdapter) UniqueId() string
func (*ProxyAdapter) UniqueIdShort ¶
func (p *ProxyAdapter) UniqueIdShort() string
func (*ProxyAdapter) UploadSpeedTest ¶
func (p *ProxyAdapter) UploadSpeedTest(max int) (int64, error)
func (*ProxyAdapter) YoutubeUnlockTest ¶
func (p *ProxyAdapter) YoutubeUnlockTest()
type ProxyDirect ¶
func (*ProxyDirect) Alive ¶
func (p *ProxyDirect) Alive() bool
func (*ProxyDirect) DelayHistory ¶
func (p *ProxyDirect) DelayHistory() []constant.DelayHistory
func (*ProxyDirect) DialUDP ¶
func (p *ProxyDirect) DialUDP(metadata *constant.Metadata) (constant.PacketConn, error)
func (*ProxyDirect) Health ¶
func (p *ProxyDirect) Health() float64
func (*ProxyDirect) HealthCheck ¶
func (p *ProxyDirect) HealthCheck(ctx context.Context)
func (*ProxyDirect) LastDelay ¶
func (p *ProxyDirect) LastDelay() uint16
func (*ProxyDirect) LastSpeed ¶
func (p *ProxyDirect) LastSpeed() int64
type ProxyList ¶
type ProxyList []AdapterProxy
func (ProxyList) All ¶
func (ss ProxyList) All(fn func(value AdapterProxy) bool) bool
All will return true if all callbacks return true. It follows the same logic as the all() function in Python.
If the list is empty then true is always returned.
func (ProxyList) Any ¶
func (ss ProxyList) Any(fn func(value AdapterProxy) bool) bool
Any will return true if any callbacks return true. It follows the same logic as the any() function in Python.
If the list is empty then false is always returned.
func (ProxyList) Append ¶
func (ss ProxyList) Append(elements ...AdapterProxy) ProxyList
Append will return a new slice with the elements appended to the end.
It is acceptable to provide zero arguments.
func (ProxyList) Bottom ¶
Bottom will return n elements from bottom
that means that elements is taken from the end of the slice for this [1,2,3] slice with n == 2 will be returned [3,2] if the slice has less elements then n that'll return all elements if n < 0 it'll return empty slice.
func (ProxyList) Contains ¶
func (ss ProxyList) Contains(lookingFor AdapterProxy) bool
Contains returns true if the element exists in the slice.
When using slices of pointers it will only compare by address, not value.
func (ProxyList) Diff ¶
Diff returns the elements that needs to be added or removed from the first slice to have the same elements in the second slice.
The order of elements is not taken into consideration, so the slices are treated sets that allow duplicate items.
The added and removed returned may be blank respectively, or contain upto as many elements that exists in the largest slice.
func (ProxyList) DropTop ¶
DropTop will return the rest slice after dropping the top n elements if the slice has less elements then n that'll return empty slice if n < 0 it'll return empty slice.
func (ProxyList) DropWhile ¶
func (ss ProxyList) DropWhile(f func(s AdapterProxy) bool) (ss2 ProxyList)
Drop items from the slice while f(item) is true. Afterwards, return every element until the slice is empty. It follows the same logic as the dropwhile() function from itertools in Python.
func (ProxyList) Each ¶
func (ss ProxyList) Each(fn func(AdapterProxy)) ProxyList
Each is more condensed version of Transform that allows an action to happen on each elements and pass the original slice on.
cars.Each(func (car *Car) { fmt.Printf("Car color is: %s\n", car.Color) })
Pie will not ensure immutability on items passed in so they can be manipulated, if you choose to do it this way, for example:
// Set all car colors to Red. cars.Each(func (car *Car) { car.Color = "Red" })
func (ProxyList) Equals ¶
Equals compare elements from the start to the end,
if they are the same is considered the slices are equal if all elements are the same is considered the slices are equal if each slice == nil is considered that they're equal
if element realizes Equals interface it uses that method, in other way uses default compare
func (ProxyList) Extend ¶
Extend will return a new slice with the slices of elements appended to the end.
It is acceptable to provide zero arguments.
func (ProxyList) Filter ¶
func (ss ProxyList) Filter(condition func(AdapterProxy) bool) (ss2 ProxyList)
Filter will return a new slice containing only the elements that return true from the condition. The returned slice may contain zero elements (nil).
FilterNot works in the opposite way of Filter.
func (ProxyList) FilterNot ¶
func (ss ProxyList) FilterNot(condition func(AdapterProxy) bool) (ss2 ProxyList)
FilterNot works the same as Filter, with a negated condition. That is, it will return a new slice only containing the elements that returned false from the condition. The returned slice may contain zero elements (nil).
func (ProxyList) FindFirstUsing ¶
func (ss ProxyList) FindFirstUsing(fn func(value AdapterProxy) bool) int
FindFirstUsing will return the index of the first element when the callback returns true or -1 if no element is found. It follows the same logic as the findIndex() function in Javascript.
If the list is empty then -1 is always returned.
func (ProxyList) First ¶
func (ss ProxyList) First() AdapterProxy
First returns the first element, or zero. Also see FirstOr().
func (ProxyList) FirstOr ¶
func (ss ProxyList) FirstOr(defaultValue AdapterProxy) AdapterProxy
FirstOr returns the first element or a default value if there are no elements.
func (ProxyList) Insert ¶
func (ss ProxyList) Insert(index int, values ...AdapterProxy) ProxyList
Insert a value at an index
func (ProxyList) JSONBytes ¶
JSONBytes returns the JSON encoded array as bytes.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array.
func (ProxyList) JSONBytesIndent ¶
JSONBytesIndent returns the JSON encoded array as bytes with indent applied.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array. See json.MarshalIndent for details.
func (ProxyList) JSONString ¶
JSONString returns the JSON encoded array as a string.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array.
func (ProxyList) JSONStringIndent ¶
JSONStringIndent returns the JSON encoded array as a string with indent applied.
One important thing to note is that it will treat a nil slice as an empty slice to ensure that the JSON value return is always an array. See json.MarshalIndent for details.
func (ProxyList) Last ¶
func (ss ProxyList) Last() AdapterProxy
Last returns the last element, or zero. Also see LastOr().
func (ProxyList) LastOr ¶
func (ss ProxyList) LastOr(defaultValue AdapterProxy) AdapterProxy
LastOr returns the last element or a default value if there are no elements.
func (ProxyList) Map ¶
func (ss ProxyList) Map(fn func(AdapterProxy) AdapterProxy) (ss2 ProxyList)
Map will return a new slice where each element has been mapped (transformed). The number of elements returned will always be the same as the input.
Be careful when using this with slices of pointers. If you modify the input value it will affect the original slice. Be sure to return a new allocated object or deep copy the existing one.
func (ProxyList) Mode ¶
Mode returns a new slice containing the most frequently occuring values.
The number of items returned may be the same as the input or less. It will never return zero items unless the input slice has zero items.
func (*ProxyList) Pop ¶
func (ss *ProxyList) Pop() (popped *AdapterProxy)
Pop the first element of the slice
Usage Example:
type knownGreetings []string greetings := knownGreetings{"ciao", "hello", "hola"} for greeting := greetings.Pop(); greeting != nil; greeting = greetings.Pop() { fmt.Println(*greeting) }
func (ProxyList) Random ¶
func (ss ProxyList) Random(source rand.Source) AdapterProxy
Random returns a random element by your rand.Source, or zero
func (ProxyList) Reverse ¶
Reverse returns a new copy of the slice with the elements ordered in reverse. This is useful when combined with Sort to get a descending sort order:
ss.Sort().Reverse()
func (ProxyList) Send ¶
func (ss ProxyList) Send(ctx context.Context, ch chan<- AdapterProxy) ProxyList
Send sends elements to channel in normal act it sends all elements but if func canceled it can be less
it locks execution of gorutine it doesn't close channel after work returns sended elements if len(this) != len(old) considered func was canceled
func (ProxyList) SequenceUsing ¶
func (ss ProxyList) SequenceUsing(creator func(int) AdapterProxy, params ...int) ProxyList
SequenceUsing generates slice in range using creator function
There are 3 variations to generate:
- [0, n).
- [min, max).
- [min, max) with step.
if len(params) == 1 considered that will be returned slice between 0 and n, where n is the first param, [0, n). if len(params) == 2 considered that will be returned slice between min and max, where min is the first param, max is the second, [min, max). if len(params) > 2 considered that will be returned slice between min and max with step, where min is the first param, max is the second, step is the third one, [min, max) with step, others params will be ignored
func (ProxyList) Shift ¶
func (ss ProxyList) Shift() (AdapterProxy, ProxyList)
Shift will return two values: the shifted value and the rest slice.
func (ProxyList) SortStableUsing ¶
func (ss ProxyList) SortStableUsing(less func(a, b AdapterProxy) bool) ProxyList
SortStableUsing works similar to sort.SliceStable. However, unlike sort.SliceStable the slice returned will be reallocated as to not modify the input slice.
func (ProxyList) SortUsing ¶
func (ss ProxyList) SortUsing(less func(a, b AdapterProxy) bool) ProxyList
SortUsing works similar to sort.Slice. However, unlike sort.Slice the slice returned will be reallocated as to not modify the input slice.
func (ProxyList) Strings ¶
Strings transforms each element to a string.
If the element type implements fmt.Stringer it will be used. Otherwise it will fallback to the result of:
fmt.Sprintf("%v")
func (ProxyList) StringsUsing ¶
func (ss ProxyList) StringsUsing(transform func(AdapterProxy) string) pie.Strings
StringsUsing transforms each element to a string.
func (ProxyList) SubSlice ¶
SubSlice will return the subSlice from start to end(excluded)
Condition 1: If start < 0 or end < 0, nil is returned. Condition 2: If start >= end, nil is returned. Condition 3: Return all elements that exist in the range provided, if start or end is out of bounds, zero items will be placed.
func (ProxyList) Top ¶
Top will return n elements from head of the slice if the slice has less elements then n that'll return all elements if n < 0 it'll return empty slice.
func (ProxyList) Unshift ¶
func (ss ProxyList) Unshift(elements ...AdapterProxy) (unshift ProxyList)
Unshift adds one or more elements to the beginning of the slice and returns the new slice.
type TotalTracker ¶
type TotalTracker struct {
// contains filtered or unexported fields
}
func NewTotalTracker ¶
func NewTotalTracker() *TotalTracker
func (*TotalTracker) Download ¶
func (p *TotalTracker) Download() uint64
func (*TotalTracker) IncrDownload ¶
func (p *TotalTracker) IncrDownload(size uint64)
func (*TotalTracker) IncrUpload ¶
func (p *TotalTracker) IncrUpload(size uint64)
func (*TotalTracker) RegisterTotalTracker ¶
func (p *TotalTracker) RegisterTotalTracker(tracker Tracker)
func (*TotalTracker) Upload ¶
func (p *TotalTracker) Upload() uint64
type YoutubeUnlockInfo ¶
type YoutubeUnlockInfo struct { Unlocked bool `json:"unlocked,omitempty"` LinkWay string `json:"link_way,omitempty"` CacheRegion string `json:"cache_region,omitempty"` Region string `json:"region,omitempty"` ISP string `json:"isp,omitempty"` }
func (YoutubeUnlockInfo) String ¶
func (p YoutubeUnlockInfo) String() string