entry

package
v0.0.0-...-852e987 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2018 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	Method      *String
	Status      *Status
	URL         *URL
	Params      *Map
	ReqHeaders  *Map
	ReqBody     *String
	RespHeaders *Map
	RespBody    *String
}

Document defines a struct of all the possible things that a http request could encounter.

type Entries

type Entries []Entry

Entries is a type alias for a slice of Entry

func (Entries) GroupBy

func (e Entries) GroupBy(fn func(Entry) string) GroupedEntries

GroupBy defines a way to group entires by a particular key

func (Entries) Method

func (e Entries) Method() *String

Method returns a String of all possible methods.

func (Entries) Params

func (e Entries) Params() *Map

Params returns a Map of all possible http parameters

func (Entries) ReqBody

func (e Entries) ReqBody() *String

ReqBody returns a String of all possible http request bodies

func (Entries) ReqHeaders

func (e Entries) ReqHeaders() *Map

ReqHeaders returns a Map of all possible http request headers

func (Entries) RespBody

func (e Entries) RespBody() *String

RespBody returns a String of all possible http response bodies

func (Entries) RespHeaders

func (e Entries) RespHeaders() *Map

RespHeaders returns a Map of all possible http response headers

func (Entries) Status

func (e Entries) Status() *Status

Status returns a Status of all possible http status

func (Entries) URL

func (e Entries) URL() *URL

URL returns a URL of all possible entries.

type Entry

type Entry struct {
	URL         *url.URL
	Method      string
	Status      int
	ReqHeaders  http.Header
	ReqBody     func() []byte
	RespHeaders http.Header
	RespBody    func() []byte
}

Entry defines a raw http request.

func (Entry) NormalisePath

func (e Entry) NormalisePath() string

NormalisePath attempts to normalise both a Host and Path in a sane way

type GroupedEntries

type GroupedEntries map[string][]Entry

GroupedEntries allows the grouping of all entries for a specific key

func (GroupedEntries) Walk

func (g GroupedEntries) Walk(fn func(Entries) (Document, error)) ([]Document, error)

Walk allows the walking over of each Entry returning a Document

type HostPath

type HostPath struct {
	Host, Path string
}

HostPath is a tuple of both the Host and the Path

func (HostPath) String

func (h HostPath) String() string

type HostPathScore

type HostPathScore struct {
	HostPath HostPath
	Score    Score
}

HostPathScore is a tuple of both the HostPath and a Score for sorting

type Map

type Map struct {
	// contains filtered or unexported fields
}

Map defines a structure of values with associated scores and a threshold score, which states what should be worked upon.

func NewMap

func NewMap() *Map

NewMap creates a Map with some default sane values.

func (*Map) Add

func (p *Map) Add(params ValuesPromoted)

Add adds ValuesPromoted to the map

func (*Map) Difference

func (p *Map) Difference() []ValuesScore

Difference returns a slice of ValuesScore that are not common.

func (*Map) Len

func (p *Map) Len() int

Len returns the total number of ValuesPromoted created

func (*Map) Union

func (p *Map) Union() ValuesScore

Union returns the common ValuesScore of the map.

type Score

type Score float64

Score is a type alias for a score, which is modelled as float64

type ScorePromoted

type ScorePromoted struct {
	Score    Score
	Promoted bool
}

ScorePromoted defines a score that can be promoted

type Status

type Status struct {
	// contains filtered or unexported fields
}

func NewStatus

func NewStatus() *Status

func (*Status) Add

func (m *Status) Add(status int)

func (*Status) Difference

func (m *Status) Difference() []StatusScore

func (*Status) Len

func (m *Status) Len() int

func (*Status) String

func (m *Status) String() string

func (*Status) Union

func (m *Status) Union() StatusScore

type StatusScore

type StatusScore struct {
	Status int
	Score  Score
}

type String

type String struct {
	// contains filtered or unexported fields
}

String holds a series of string values with associated scores

func NewString

func NewString() *String

NewString returns a new String

func (*String) Add

func (m *String) Add(method string)

Add adds the method to the string and updates the totals

func (*String) Difference

func (m *String) Difference() []StringScore

Difference returns a slice of StringScores that doesn't equal the Union.

func (*String) Len

func (m *String) Len() int

Len returns the total added methods using add

func (*String) String

func (m *String) String() string

func (*String) Union

func (m *String) Union() StringScore

Union returns the most common string

type StringScore

type StringScore struct {
	String string
	Score  Score
}

StringScore is a tuple containing a string and a score

type Strings

type Strings []string

Strings is a type alias for a slice of strings

func ToStrings

func ToStrings(x interface{}) Strings

ToStrings attempts to convert a interface{} to a string if possible.

func (Strings) Join

func (s Strings) Join() string

Join joins all the strings in a csv format.

type URL

type URL struct {
	// contains filtered or unexported fields
}

URL holds various HostPath and scores, along with the total number of urls

func NewURL

func NewURL() *URL

NewURL creates a URL

func (*URL) Add

func (u *URL) Add(host HostPath)

Add adds a HostPath to the URL for counting.

func (*URL) Difference

func (u *URL) Difference() []HostPathScore

Difference returns all the HostPathScore's that aren't the most common.

func (*URL) Len

func (u *URL) Len() int

Len returns the total amount of HostPath's added

func (*URL) String

func (u *URL) String() string

func (*URL) Union

func (u *URL) Union() HostPathScore

Union returns the most common HostPathScore

type Value

type Value struct {
	Key, Value string
}

Value defines a Key Value tuple pairing.

type ValuePromoted

type ValuePromoted struct {
	Value    string
	Promoted bool
}

ValuePromoted defines a value that can be promoted

type ValueScore

type ValueScore struct {
	Value Value
	Score Score
}

ValueScore is a tuple of a Value and a Score

type Values

type Values map[string]string

Values is a type alias for a map which has a key and value of string

func (Values) Walk

func (v Values) Walk(fn func(string, interface{}))

Walk loops through each value in a predictable way. Note: this can be inefficient

type ValuesPromoted

type ValuesPromoted map[string]ValuePromoted

ValuesPromoted is a type alias for a map with key as a string and value as a ValuePromoted

type ValuesScore

type ValuesScore struct {
	Values Values
	Score  Score
}

ValuesScore is a tuple of a series of Values and Score

type ValuesScores

type ValuesScores []ValuesScore

ValuesScores is a type alias for sorting a slice of ValuesScore

func (ValuesScores) Len

func (v ValuesScores) Len() int

func (ValuesScores) Less

func (v ValuesScores) Less(i, j int) bool

func (ValuesScores) Swap

func (v ValuesScores) Swap(i, j int)

Jump to

Keyboard shortcuts

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