tcp

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AuthNone byte = iota
	AuthUnknown
	AuthBasic
	AuthDigest
	AuthTPLink // https://drmnsamoliu.github.io/video.html
)
View Source
const EndLine = "\r\n"

Variables

This section is empty.

Functions

func B64

func B64(s ...string) string

func Between

func Between(s, sub1, sub2 string) string

func Close added in v1.3.0

func Close(res *http.Response)

func Dial added in v1.7.0

func Dial(u *url.URL, timeout time.Duration) (net.Conn, error)

Dial - for RTSP(S|X) and RTMP(S|X)

func Do

func Do(req *http.Request) (*http.Response, error)

Do - http.Client with support Digest Authorization

func HexMD5

func HexMD5(s ...string) string

func IsIP added in v1.7.0

func IsIP(hostname string) bool

func RemoteAddr added in v1.3.1

func RemoteAddr(r *http.Request) string

func WithConn added in v1.3.0

func WithConn() (context.Context, *net.Conn)

Types

type Auth

type Auth struct {
	Method byte
	// contains filtered or unexported fields
}

func NewAuth

func NewAuth(user *url.Userinfo) *Auth

func (*Auth) Read

func (a *Auth) Read(res *Response) bool

func (*Auth) ReadNone added in v1.2.0

func (a *Auth) ReadNone(res *Response) bool

func (*Auth) Validate

func (a *Auth) Validate(req *Request) bool

func (*Auth) Write

func (a *Auth) Write(req *Request)

type Request

type Request struct {
	Method string
	URL    *url.URL
	Proto  string
	Header textproto.MIMEHeader
	Body   []byte
}

Request like http.Request, but with any proto

func ReadRequest

func ReadRequest(r *bufio.Reader) (*Request, error)

func (*Request) String

func (r *Request) String() string

func (*Request) Write

func (r *Request) Write(w io.Writer) (err error)

type Response

type Response struct {
	Status     string
	StatusCode int
	Proto      string
	Header     textproto.MIMEHeader
	Body       []byte
	Request    *Request
}

Response like http.Response, but with any proto

func ReadResponse

func ReadResponse(r *bufio.Reader) (*Response, error)

func (Response) String

func (r Response) String() string

func (*Response) Write

func (r *Response) Write(w io.Writer) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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