ipPool

package
v2.1.8 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func func() (res []string)

type IpPool

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

func New

func New(tag string, redis *redis.Client, expire time.Duration, sourceFunc ...Func) *IpPool

func (*IpPool) Getter

func (i *IpPool) Getter(wayRemove bool) (ip string, err error)

获取IP

func (*IpPool) GetterWait

func (i *IpPool) GetterWait(wayRemove bool) (ip string)

获取ip,没有则阻塞,直到获取到

func (*IpPool) Remove

func (i *IpPool) Remove(ip string)

释放

type Source

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

func (*Source) AddSource

func (s *Source) AddSource(source ...Func)

添加来源

func (*Source) GetFuncResult

func (s *Source) GetFuncResult() (res []Func)

func (*Source) RemoveSource

func (s *Source) RemoveSource(source Func)

删除来源

Jump to

Keyboard shortcuts

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