conn

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CONN_ERR = "conn err"
	CONN_ADD = "conn add"
	CONN_GET = "conn get"
	CONN_PUT = "conn put"
	CONN_END = "conn end"
)
View Source
const CONN = "conn"
View Source
const HTTP = "http"
View Source
const POOL = "pool"

Variables

View Source
var (
	ErrTypeError = errors.New("type error")
	ErrUnknown   = errors.New("unknown error")
)

Functions

This section is empty.

Types

type Any added in v0.6.4

type Any = interface{}

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*Conn) Close

func (conn *Conn) Close() error

func (*Conn) Info

func (conn *Conn) Info() string

func (*Conn) Read

func (conn *Conn) Read(b []byte) (int, error)

func (*Conn) Write

func (conn *Conn) Write(b []byte) (int, error)

type HttpClient

type HttpClient struct {
	*http.Client

	DoCount   int
	GetCount  int
	PostCount int
	ErrCount  int

	Logger func(...Any)
	// contains filtered or unexported fields
}

func (*HttpClient) Do

func (client *HttpClient) Do(meta task.Meta, req *http.Request) (*http.Response, error)

func (*HttpClient) Get

func (client *HttpClient) Get(meta task.Meta, url string) (*http.Response, error)

func (*HttpClient) Info

func (client *HttpClient) Info() string

func (*HttpClient) NRead

func (client *HttpClient) NRead() int

func (*HttpClient) NWrite

func (client *HttpClient) NWrite() int

func (*HttpClient) Release added in v0.6.4

func (client *HttpClient) Release()

type Pool

type Pool struct {
	Logger func(...Any)

	sync.Pool
	// contains filtered or unexported fields
}

func New

func New(conf *conf.Conf, maxconn int64, target []string, retry int) *Pool

func (*Pool) Close added in v0.6.4

func (pool *Pool) Close()

func (*Pool) Get

func (pool *Pool) Get(meta task.Meta, ctx context.Context) *Conn

func (*Pool) GetHttp

func (pool *Pool) GetHttp(meta task.Meta, ctx context.Context) (*HttpClient, error)

func (*Pool) Put

func (pool *Pool) Put(c *Conn)

Jump to

Keyboard shortcuts

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