Documentation
¶
Index ¶
- Constants
- Variables
- func AppendRequestURI(u, requestURI string) (string, error)
- func AutoMergePaths(relpath1 string, relpath2 string) string
- func ChangePort(u, port string) (string, error)
- func ParamEncode(data string) string
- func PercentEncoding(data string) string
- func PreprendDefaultScheme(u string) string
- func PreprendScheme(u, scheme string) string
- func TrimPort(host, port string) string
- func TrimScheme(host string) string
- func URLEncodeWithEscapes(data string, charset ...rune) string
- type Params
- func (p Params) Add(key string, value ...string)
- func (p Params) Decode(raw string)
- func (p Params) Del(key string)
- func (p Params) Encode() string
- func (p Params) Get(key string) string
- func (p Params) Has(key string) bool
- func (p Params) Merge(x Params)
- func (p Params) Set(key string, value string)
- type RawURL
- type URL
Constants ¶
const ( HTTP = "http" HTTPS = "https" DefaultHTTPPort = "80" DefaultHTTPSPort = "443" )
Variables ¶
var AllowLegacySeperator bool = false
Legacy Seperator (i.e `;`) is used as seperator for parameters this was removed in go >=1.17
var MustEscapeCharSet []rune = []rune{'?', '#', '@', ';', '&', ',', '[', ']', '^'}
MustEscapeCharSet are special chars that are always escaped and are based on reserved chars from RFC Some of Reserved Chars From RFC were excluded and some were added for various reasons and goal here is to encode parameters key and value only
var RFCEscapeCharSet []rune = []rune{'!', '*', '\'', '(', ')', ';', ':', '@', '&', '=', '+', '$', ',', '/', '?', '%', '#', '[', ']'}
Reserved Chars from RFC ! * ' ( ) ; : @ & = + $ , / ? % # [ ]
Functions ¶
func AppendRequestURI ¶
func AutoMergePaths ¶ added in v0.0.4
AutoMergePaths merges two relative paths including parameters and returns final string
func ChangePort ¶
func ParamEncode ¶ added in v0.0.4
ParamEncode encodes Key characters only. key characters include whitespaces + non printable chars + non-ascii also this does not double encode encoded characters
func PercentEncoding ¶ added in v0.0.4
PercentEncoding encodes all characters to percent encoded format just like burpsuite decoder
func PreprendDefaultScheme ¶
func PreprendScheme ¶
func TrimScheme ¶
func URLEncodeWithEscapes ¶ added in v0.0.4
URLEncodeWithEscapes URL encodes data with given special characters escaped (similar to burpsuite intruder) Note `MustEscapeCharSet` is not included
Types ¶
type Params ¶ added in v0.0.4
func (Params) Decode ¶ added in v0.0.4
Decode is opposite of Encode() where ("bar=baz&foo=quux") is parsed Parameters are loosely parsed to allow any scenario
func (Params) Encode ¶ added in v0.0.4
Encode URL encodes and returns values ("bar=baz&foo=quux") sorted by key.
type RawURL ¶ added in v0.0.4
type RawURL struct {
Original string // raw or Original string (excluding params and fragment)
Path string // Path is Relative Path
Unsafe bool // when unsafe parsing(host,port etc) is not guaranteed
Fragment string
// contains filtered or unexported fields
}
RawURL is wrapper around url.URL that can handle all path and parameters including raw unsafe requests