socket

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckCbkFuc

type CheckCbkFuc func(data byte) bool

type CheckTarget

type CheckTarget struct {
	Target        string         `json:"target"`        // 目标
	Port          int            `json:"port"`          // 端口
	ConnState     bool           `json:"connState"`     // 连接状态
	ConnType      string         `json:"connType"`      // 连接类型:tcp
	ReadTimeout   int            `json:"readTimeout"`   // 读数据超市
	CheckCbkLists []*CheckCbkFuc `json:"checkCbkLists"` // 回调接口
	Conn          net.Conn       `json:"conn"`          // 连接对象
	//ConnTLS       *tls.Conn      `json:"conn"`          // ssl 连接对象
	MacReadSize      uint32 `json:"macReadSize"` // 最大允许读取调数据,避免被反制内存攻击,default:200k
	HostName         string `json:"hostName"`    // http header host
	UrlPath          string `json:"urlPath"`     // http中url path
	UrlRaw           string `json:"urlRaw"`      // full url
	IsTLS            bool   `json:"isTLS"`       // https
	CustomHeadersRaw string `json:"customHeadersRaw"`
}

func NewCheckTarget

func NewCheckTarget(szUrl, SzType string, readWriteTimeout int) *CheckTarget

准备要检测、链接带目标 需要考虑 ssl的情况

func (*CheckTarget) AddCheck

func (r *CheckTarget) AddCheck(fnCbk CheckCbkFuc, aN ...int) *CheckTarget

添加检测函数 如果检测函数返回true,就不关闭链接,继续发送后续带数据包

func (*CheckTarget) Close

func (r *CheckTarget) Close()

关闭连接

func (*CheckTarget) ConnTarget

func (r *CheckTarget) ConnTarget() (*CheckTarget, error)

连接目标 sysctl -w net.ipv4.tcp_keepalive_time=300 sysctl -w net.ipv4.tcp_keepalive_intvl=30 sysctl -w net.ipv4.tcp_keepalive_probes=5

func (*CheckTarget) GetBufReader

func (r *CheckTarget) GetBufReader() *bufio.Reader

获取操作io

func (*CheckTarget) GetBufWriter

func (r *CheckTarget) GetBufWriter() *bufio.Writer

func (*CheckTarget) Log

func (r *CheckTarget) Log(s string)

func (*CheckTarget) ReadAll2Bytes

func (r *CheckTarget) ReadAll2Bytes() *[]byte

func (*CheckTarget) ReadAll2Str

func (r *CheckTarget) ReadAll2Str() *string

读取所有文本

func (*CheckTarget) SendOnePayload

func (r *CheckTarget) SendOnePayload(str, szPath, szHost string, nTimes int) string

send one payload and close

func (*CheckTarget) WriteWithFlush

func (r *CheckTarget) WriteWithFlush(s string) (nn int, err error)

获取操作io

Jump to

Keyboard shortcuts

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