model

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Version string = "0.0.0"
	Commit  string = "unknown"
	Date    string = time.Now().Format("2006-01-02")
)

Functions

func GetVersion

func GetVersion() string

func PrintVersion

func PrintVersion()

Types

type BigIntWrapper

type BigIntWrapper struct {
	BigInt *big.Int
}

func (*BigIntWrapper) MarshalJSON

func (b *BigIntWrapper) MarshalJSON() ([]byte, error)

func (*BigIntWrapper) UnmarshalJSON

func (b *BigIntWrapper) UnmarshalJSON(data []byte) error

type CertificateWrapper

type CertificateWrapper struct {
	Fingerprint string `json:"fingerprint" bson:"fingerprint"`
	Raw         []byte `json:"raw" bson:"raw"`
}

CertificateWrapper is copied from crypto/x509/x509.go

type HTTP

type HTTP struct {
	Request  *HTTPRequest  `json:"request,omitempty"`
	Response *HTTPResponse `json:"response,omitempty"`
}

type HTTPRequest

type HTTPRequest struct {
	Method string `json:"method"`
	URL    string `json:"url"`
	Host   string `json:"host"`

	RemoteAddr string `json:"remote_addr"`
	RequestURI string `json:"request_uri"`

	Proto      string `json:"proto"`
	ProtoMajor int    `json:"proto_major"`
	ProtoMinor int    `json:"proto_minor"`

	Headers http.Header `json:"headers"`

	ContentLength    int64    `json:"content_length"`
	TransferEncoding []string `json:"transfer_encoding,omitempty"`
	Close            bool     `json:"close"`

	Form          url.Values      `json:"form,omitempty"`
	PostForm      url.Values      `json:"post_form,omitempty"`
	MultipartForm *multipart.Form `json:"multipart_form,omitempty"`

	RawBody    []byte `json:"raw_body"`
	BodySha256 string `json:"body_sha256"`
	Body       string `json:"body"`

	Trailer http.Header `json:"trailer,omitempty"`
}

func NewHTTPRequest

func NewHTTPRequest(req *http.Request) (*HTTPRequest, error)

type HTTPResponse

type HTTPResponse struct {
	Status     string `json:"status"`
	StatusCode int    `json:"status_code"`

	Proto      string `json:"proto"`
	ProtoMajor int    `json:"proto_major"`
	ProtoMinor int    `json:"proto_minor"`

	Headers http.Header `json:"headers"`

	RawBody    []byte `json:"raw_body"`
	BodySha256 string `json:"body_sha256"`
	Body       string `json:"body"`

	ContentLength    int64       `json:"content_length"`
	TransferEncoding []string    `json:"transfer_encoding,omitempty"`
	Close            bool        `json:"close"`
	Uncompressed     bool        `json:"uncompressed"`
	Trailer          http.Header `json:"trailer"`
}

func NewHTTPResponse

func NewHTTPResponse(resp *http.Response) (*HTTPResponse, error)

type TLS

type TLS struct {
	// Version is the TLS version used by the connection (e.g. VersionTLS12).
	Version uint16 `json:"version"`

	// HandshakeComplete is true if the handshake has concluded.
	HandshakeComplete bool `json:"handshake_complete"`

	// DidResume is true if this connection was successfully resumed from a
	// previous session with a session ticket or similar mechanism.
	DidResume bool `json:"did_resume"`

	// CipherSuite is the cipher suite negotiated for the connection (e.g.
	// TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_AES_128_GCM_SHA256).
	CipherSuite uint16 `json:"cipher_suite"`

	// NegotiatedProtocol is the application protocol negotiated with ALPN.
	NegotiatedProtocol string `json:"negotiated_protocol"`

	// ServerName is the value of the Server Name Indication extension sent by
	// the client. It's available both on the server and on the client side.
	ServerName string `json:"server_name"`

	// PeerCertificate *x509.Certificate `json:"peer_certificate,omitempty"`
	PeerCertificate *CertificateWrapper `json:"peer_certificate,omitempty"`
}

func NewTLS

func NewTLS(cs *tls.ConnectionState) *TLS

type Task

type Task struct {
	IP                 string            `json:"ip"`
	Port               uint16            `json:"port"`
	Scheme             string            `json:"scheme"`
	Method             string            `json:"method"`
	Path               string            `json:"path"`
	Host               string            `json:"host"`
	HostType           string            `json:"host_type"`
	Body               string            `json:"body"`
	Queries            map[string]string `json:"queries"`
	Headers            map[string]string `json:"headers"`
	Cookies            map[string]string `json:"cookies"`
	SNI                string            `json:"sni"`
	HTTP               HTTP              `json:"http"`
	TLS                *TLS              `json:"tls,omitempty"`
	ConnectTimeout     int               `json:"connect_timeout"`
	Timeout            int               `json:"timeout"`
	InsecureSkipVerify bool              `json:"insecure_skip_verify"`
	Error              string            `json:"error"`
}

func NewTask

func NewTask(line string) *Task

func (*Task) Do

func (t *Task) Do() error

func (*Task) URL

func (t *Task) URL() *url.URL

func (*Task) WithBody

func (t *Task) WithBody(body string) *Task

func (*Task) WithConnectTimeout

func (t *Task) WithConnectTimeout(connectTimeout int) *Task

func (*Task) WithCookie

func (t *Task) WithCookie(key, value string) *Task

func (*Task) WithHeader

func (t *Task) WithHeader(key, value string) *Task

func (*Task) WithHost

func (t *Task) WithHost(host string) *Task

func (*Task) WithHostType

func (t *Task) WithHostType(hostType string) *Task

func (*Task) WithInsecureSkipVerify

func (t *Task) WithInsecureSkipVerify(insecureSkipVerify bool) *Task

func (*Task) WithMethod

func (t *Task) WithMethod(method string) *Task

func (*Task) WithPath

func (t *Task) WithPath(path string) *Task

func (*Task) WithPort

func (t *Task) WithPort(port uint16) *Task

func (*Task) WithQuery

func (t *Task) WithQuery(key, value string) *Task

func (*Task) WithSNI

func (t *Task) WithSNI(sni string) *Task

func (*Task) WithScheme

func (t *Task) WithScheme(scheme string) *Task

func (*Task) WithTimeout

func (t *Task) WithTimeout(timeout int) *Task

Jump to

Keyboard shortcuts

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