rawhttp

package
v0.0.0-...-0f5f40a Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultNoProxy = "NO-PROXY"
	DefaultTimeout = time.Second * 10
)
View Source
const (
	MethodConnect = "CONNECT"
	MethodDelete  = "DELETE"
	MethodGet     = "GET"
	MethodHead    = "HEAD"
	MethodOptions = "OPTIONS"
	MethodPatch   = "PATCH"
	MethodPost    = "POST"
	MethodPut     = "PUT"
	MethodTrace   = "TRACE"
)
View Source
const (
	IPv4   = HostType(0x000f)
	IPv6   = HostType(0x00f0)
	Domain = HostType(0x0f00)
)

Variables

View Source
var DirectShortTimeoutClient = &HTTPClient{
	Timeout:      3 * time.Second,
	ProxyAddr:    DefaultNoProxy,
	Debug:        false,
	MaxRedirects: 5,
}

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient struct {
	Timeout      time.Duration
	ProxyAddr    string
	Debug        bool
	MaxRedirects int
}

func NewHTTPClient

func NewHTTPClient(timeout time.Duration, proxyAddr string) (*HTTPClient, error)

func (*HTTPClient) DoReq

func (c *HTTPClient) DoReq(req *Request) (*Response, error)

func (*HTTPClient) Get

func (c *HTTPClient) Get(url string) (*Response, error)

func (*HTTPClient) PostForm

func (c *HTTPClient) PostForm(url string, body []byte) (*Response, error)

func (*HTTPClient) PostJson

func (c *HTTPClient) PostJson(url string, body []byte) (*Response, error)

func (*HTTPClient) PostXml

func (c *HTTPClient) PostXml(url string, body []byte) (*Response, error)

func (*HTTPClient) SetDebug

func (c *HTTPClient) SetDebug(debug bool)

type HostType

type HostType int

type Request

type Request struct {
	ID string
	// 目标信息
	Protocol       string
	Domain         string
	IP             string
	Port           string
	Path           string
	Method         string
	Headers        map[string]string
	FollowRedirect bool
	// 请求处理信息
	RawBody    []byte
	RawHeader  []byte
	RawRequest []byte

	// 特殊信息
	IsFromPoC bool
	// contains filtered or unexported fields
}

func NewRequest

func NewRequest(target string, method string) (*Request, error)

func (*Request) SetBody

func (r *Request) SetBody(body string)

func (*Request) SetBytesBody

func (r *Request) SetBytesBody(body []byte)

func (*Request) SetFollowRedirect

func (r *Request) SetFollowRedirect(redirect bool)

func (*Request) SetHeader

func (r *Request) SetHeader(key string, value string)

type Response

type Response struct {
	StatusCode  int
	Status      string
	Headers     map[string][]string
	Body        []byte
	RawResponse []byte
	RawRequest  []byte
}

Jump to

Keyboard shortcuts

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