nkngomobile

package module
v0.0.0-...-671ad1a Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: Apache-2.0 Imports: 8 Imported by: 15

README

nkngomobile

nkngomobile

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidIP = errors.New("invalid IP address")

Functions

func IpRangeToCIDR

func IpRangeToCIDR(start, end uint32) []string

IpRangeToCIDR both side inclusive

func IpToUint32

func IpToUint32(s string) (uint32, error)

func Uint32ToIP

func Uint32ToIP(n uint32) net.IP

Types

type Resolver

type Resolver interface {
	Resolve(address string) (string, error)
}

type ResolverArray

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

ResolverArray is a wrapper type for gomobile compatibility. ResolverArray is not protected by lock and should not be read and write at the same time.

func NewResolverArray

func NewResolverArray(elems ...Resolver) *ResolverArray

NewResolverArray creates a ResolverArray from a list of string elements.

func NewResolverArrayFromResolver

func NewResolverArrayFromResolver(e Resolver) *ResolverArray

NewResolverArrayFromResolver creates a ResolverArray from a single string input. The input string will be split to string array by whitespace.

func (*ResolverArray) Append

func (ia *ResolverArray) Append(a Resolver)

Append adds an element to the string array.

func (*ResolverArray) Elems

func (ia *ResolverArray) Elems() []Resolver

Elems returns the string array elements.

func (*ResolverArray) Get

func (ia *ResolverArray) Get(i int) Resolver

Get gets an element to the string array.

func (*ResolverArray) Len

func (ia *ResolverArray) Len() int

Len returns the string array length.

func (*ResolverArray) RandomElem

func (ia *ResolverArray) RandomElem() Resolver

RandomElem returns a randome element from the string array. The random number is generated using math/rand and thus not cryptographically secure.

type StringArray

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

StringArray is a wrapper type for gomobile compatibility. StringArray is not protected by lock and should not be read and write at the same time.

func ExcludeRoute

func ExcludeRoute(ipArray *StringArray) *StringArray

func NewStringArray

func NewStringArray(elems ...string) *StringArray

NewStringArray creates a StringArray from a list of string elements.

func NewStringArrayFromString

func NewStringArrayFromString(s string) *StringArray

NewStringArrayFromString creates a StringArray from a single string input. The input string will be split to string array by whitespace.

func (*StringArray) Append

func (sa *StringArray) Append(s string)

Append adds an element to the string array.

func (*StringArray) Elems

func (sa *StringArray) Elems() []string

Elems returns the string array elements.

func (*StringArray) Get

func (sa *StringArray) Get(i int) string

Get gets an element to the string array.

func (*StringArray) GetJson

func (sa *StringArray) GetJson() string

func (*StringArray) Join

func (sa *StringArray) Join(separator string) string

Join returns a single string by concatenates the elements

func (*StringArray) Len

func (sa *StringArray) Len() int

Len returns the string array length.

func (*StringArray) RandomElem

func (sa *StringArray) RandomElem() string

RandomElem returns a randome element from the string array. The random number is generated using math/rand and thus not cryptographically secure.

type StringMap

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

StringMap is a wrapper type for gomobile compatibility. StringMap is not protected by lock and should not be read and write at the same time.

func NewStringMap

func NewStringMap(m map[string]string) *StringMap

NewStringMap creates a StringMap from a map.

func NewStringMapWithSize

func NewStringMapWithSize(size int) *StringMap

NewStringMapWithSize creates an empty StringMap with a given size.

func (*StringMap) Delete

func (sm *StringMap) Delete(key string)

Delete deletes a key and its value from the map.

func (*StringMap) Get

func (sm *StringMap) Get(key string) (string, error)

Get returns the value of a key, or ErrKeyNotInMap if key does not exist.

func (*StringMap) Len

func (sm *StringMap) Len() int

Len returns the number of elements in the map.

func (*StringMap) Map

func (sm *StringMap) Map() map[string]string

func (*StringMap) Range

func (sm *StringMap) Range(cb StringMapFunc)

Range iterates over the StringMap and call the OnVisit callback function with each element in the map. If the OnVisit function returns false, the iterator will stop and no longer visit the rest elements.

func (*StringMap) Set

func (sm *StringMap) Set(key string, value string)

Set sets the value of a key to a value.

type StringMapFunc

type StringMapFunc interface{ OnVisit(string, string) bool }

StringMapFunc is a wrapper type for gomobile compatibility.

Jump to

Keyboard shortcuts

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