utils

package
v3.0.0-...-7b6adf0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KnownVariables maputil.Map[KnownVariable, string]

KnownVariables are the variables that are known to input requests

Functions

func AddConfiguredClientCertToRequest

func AddConfiguredClientCertToRequest(tlsConfig *tls.Config, options *types.Options) (*tls.Config, error)

AddConfiguredClientCertToRequest adds the client certificate authentication to the tls.Config object and returns it

func CalculateContentLength

func CalculateContentLength(contentLength, bodyLength int64) int64

CalculateContentLength calculates content-length of the http response

func CleanStructFieldJSONTag

func CleanStructFieldJSONTag(tag string) string

CleanStructFieldJSONTag cleans struct json tag field

func GenerateDNSVariables

func GenerateDNSVariables(domain string) map[string]interface{}

GenerateDNSVariables from a dns name This function is used by dns and ssl protocol to generate variables

func GenerateVariables

func GenerateVariables(input interface{}, removeTrailingSlash bool, additionalVars map[string]interface{}) map[string]interface{}

GenerateVariables accepts string or *urlutil.URL object as input Returns the map of KnownVariables keys This function is used by http, headless, websocket, network and whois protocols to generate protocol variables

func GenerateVariablesWithContextArgs

func GenerateVariablesWithContextArgs(input *contextargs.Context, trailingSlash bool) map[string]interface{}

GenerateVariables will create default variables with context args

func HeadersToString

func HeadersToString(headers http.Header) string

headersToString converts http headers to string

Types

type JsonFields

type JsonFields struct {
	Host   string `json:"host,omitempty"`
	Path   string `json:"path,omitempty"`
	Port   string `json:"port,omitempty"`
	Ip     string `json:"ip,omitempty"`
	Scheme string `json:"scheme,omitempty"`
	URL    string `json:"url,omitempty"`
}

JsonFields contains additional metadata fields for JSON output

func GetJsonFieldsFromMetaInput

func GetJsonFieldsFromMetaInput(ctx *contextargs.MetaInput) JsonFields

GetJsonFieldsFromMetaInput returns the json fields for the request

func GetJsonFieldsFromURL

func GetJsonFieldsFromURL(URL string) JsonFields

GetJsonFields returns the json fields for the request

type KnownVariable

type KnownVariable uint16
const (
	BaseURL KnownVariable = iota
	RootURL
	Hostname
	Host
	Port
	Path
	Query
	File
	Scheme
	Input
	Fqdn
	Rdn
	Dn
	Tld
	Sd
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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