helper

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2024 License: AGPL-3.0, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanonicalAddr

func CanonicalAddr(url *url.URL) string

CanonicalAddr returns url.Host but always with a ":port" suffix.

func GetProxyConn

func GetProxyConn(ctx context.Context, proxyUrl *url.URL, address string) (net.Conn, error)

GetProxyConn connect proxy ref: http/transport.go dialConn func

func GetTlsKeyLogWriter

func GetTlsKeyLogWriter() io.Writer

func MatchHost

func MatchHost(address string, hosts []string) bool

MatchHost detect hosts is match address

func NewResponseCheck

func NewResponseCheck(r http.ResponseWriter) http.ResponseWriter

func NewStructFromFile

func NewStructFromFile(filename string, v interface{}) error

func ReaderToBuffer

func ReaderToBuffer(r io.Reader, limit int64) ([]byte, io.Reader, error)

尝试将 Reader 读取至 buffer 中 如果未达到 limit,则成功读取进入 buffer 否则 buffer 返回 nil,且返回新 Reader,状态为未读取前

Types

type ResponseCheck

type ResponseCheck struct {
	http.ResponseWriter
	Wrote bool
}

func (*ResponseCheck) Write

func (r *ResponseCheck) Write(bytes []byte) (int, error)

func (*ResponseCheck) WriteHeader

func (r *ResponseCheck) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

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