Documentation ¶
Index ¶
- Variables
- func InitProxies() error
- type ClashConfig
- type DnsType
- type Init
- type Proxies
- func (ps *Proxies) Append(contact string, name string) *Proxies
- func (ps *Proxies) AppendNetEaseWithUrl(contact string) *Proxies
- func (ps *Proxies) AppendWithUrl(contact string) *Proxies
- func (ps *Proxies) Clone() *Proxies
- func (ps *Proxies) GetUsableList(checkUrl string) (psn *Proxies)
- func (ps *Proxies) Len() int
- func (ps *Proxies) NameAddIndex() *Proxies
- func (ps *Proxies) NameReIndex() *Proxies
- func (ps *Proxies) ToClashConfig(c ClashConfig) string
- func (ps *Proxies) ToV2rayConfig() string
- type ProxyList
- func (ss ProxyList) All(fn func(value proxy.Proxy) bool) bool
- func (ss ProxyList) Any(fn func(value proxy.Proxy) bool) bool
- func (ss ProxyList) Append(elements ...proxy.Proxy) ProxyList
- func (ss ProxyList) Bottom(n int) (top ProxyList)
- func (ss ProxyList) Contains(lookingFor proxy.Proxy) bool
- func (ss ProxyList) Diff(against ProxyList) (added, removed ProxyList)
- func (ss ProxyList) DropTop(n int) (drop ProxyList)
- func (ss ProxyList) Each(fn func(proxy.Proxy)) ProxyList
- func (ss ProxyList) Equals(rhs ProxyList) bool
- func (ss ProxyList) Extend(slices ...ProxyList) (ss2 ProxyList)
- func (ss ProxyList) Filter(condition func(proxy.Proxy) bool) (ss2 ProxyList)
- func (ss ProxyList) FilterNot(condition func(proxy.Proxy) bool) (ss2 ProxyList)
- func (ss ProxyList) FindFirstUsing(fn func(value proxy.Proxy) bool) int
- func (ss ProxyList) First() proxy.Proxy
- func (ss ProxyList) FirstOr(defaultValue proxy.Proxy) proxy.Proxy
- func (ss ProxyList) Float64s() pie.Float64s
- func (ss ProxyList) Insert(index int, values ...proxy.Proxy) 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() proxy.Proxy
- func (ss ProxyList) LastOr(defaultValue proxy.Proxy) proxy.Proxy
- func (ss ProxyList) Len() int
- func (ss ProxyList) Map(fn func(proxy.Proxy) proxy.Proxy) (ss2 ProxyList)
- func (ss ProxyList) Mode() ProxyList
- func (ss *ProxyList) Pop() (popped *proxy.Proxy)
- func (ss ProxyList) Random(source rand.Source) proxy.Proxy
- func (ss ProxyList) Reverse() ProxyList
- func (ss ProxyList) Send(ctx context.Context, ch chan<- proxy.Proxy) ProxyList
- func (ss ProxyList) SequenceUsing(creator func(int) proxy.Proxy, params ...int) ProxyList
- func (ss ProxyList) Shift() (proxy.Proxy, ProxyList)
- func (ss ProxyList) Shuffle(source rand.Source) ProxyList
- func (ss ProxyList) SortStableUsing(less func(a, b proxy.Proxy) bool) ProxyList
- func (ss ProxyList) SortUsing(less func(a, b proxy.Proxy) bool) ProxyList
- func (ss ProxyList) Strings() pie.Strings
- func (ss ProxyList) StringsUsing(transform func(proxy.Proxy) 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 ...proxy.Proxy) (unshift ProxyList)
Constants ¶
This section is empty.
Variables ¶
var ClashTplUrl string
Functions ¶
func InitProxies ¶
func InitProxies() error
Types ¶
type ClashConfig ¶
func NewClashConfig ¶
func NewClashConfig() ClashConfig
type Proxies ¶
func GenClashProxies ¶
func NewProxies ¶
func NewProxies() *Proxies
func (*Proxies) AppendNetEaseWithUrl ¶
func (*Proxies) AppendWithUrl ¶
func (*Proxies) GetUsableList ¶
func (*Proxies) NameAddIndex ¶
func (*Proxies) NameReIndex ¶
func (*Proxies) ToClashConfig ¶
func (ps *Proxies) ToClashConfig(c ClashConfig) string
func (*Proxies) ToV2rayConfig ¶
type ProxyList ¶
func (ProxyList) All ¶
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 ¶
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 ¶
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 ¶
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) Each ¶
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 ¶
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 ¶
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 ¶
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) FirstOr ¶
FirstOr returns the first element or a default value if there are no elements.
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) LastOr ¶
LastOr returns the last element or a default value if there are no elements.
func (ProxyList) Map ¶
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 ¶
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) 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 ¶
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 ¶
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) SortStableUsing ¶
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 ¶
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 ¶
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.