workspace

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

func Delete(id string) error

Types

type Collection

type Collection struct {
	Groups []Group `json:"groups"`
}

type Group

type Group struct {
	ID       string    `json:"id"`
	Name     string    `json:"name"`
	Requests []Request `json:"requests"`
}

type PortList

type PortList []int

func (PortList) Match

func (r PortList) Match(port int) bool

type Request

type Request struct {
	ID         string                `json:"id"`
	Name       string                `json:"name"`
	Inner      packaging.HttpRequest `json:"inner"`
	PreScript  string                `json:"pre_script"`
	PostScript string                `json:"post_script"`
}

type Rule

type Rule struct {
	ID           int            `json:"id"`
	Protocol     string         `json:"protocol"` // e.g. http, https
	HostRegexRaw string         `json:"host"`
	HostRegex    *regexp.Regexp `json:"-"`
	PathRegexRaw string         `json:"-"`
	PathRegex    *regexp.Regexp `json:"path"`
	Ports        PortList       `json:"ports"`
}

func (Rule) MarshalJSON

func (r Rule) MarshalJSON() ([]byte, error)

func (*Rule) Match

func (r *Rule) Match(request *http.Request) bool

func (*Rule) UnmarshalJSON

func (r *Rule) UnmarshalJSON(data []byte) error

type RuleSet

type RuleSet []Rule

func (RuleSet) MarshalJSON

func (r RuleSet) MarshalJSON() ([]byte, error)

func (RuleSet) Match

func (r RuleSet) Match(request *http.Request) bool

type Scope

type Scope struct {
	// Include is a list of rules, which, if matched, will result in a request being included in the scope
	// An empty list will result in all requests being included, unless the Exclude list is used to exclude requests
	// ANY rule being matched will result in a request being included
	Include RuleSet `json:"include"`
	// the Exclude ruleset is used to exclude items that have previously been included
	// ANY rule being matched will result in a request being excluded
	Exclude RuleSet `json:"exclude"`
}

func (Scope) Includes

func (s Scope) Includes(request *http.Request) bool

type StructureNode

type StructureNode struct {
	ID       string          `json:"id"`
	Name     string          `json:"name"`
	Children []StructureNode `json:"children"`
}

func (*StructureNode) MarshalJSON

func (t *StructureNode) MarshalJSON() ([]byte, error)

func (*StructureNode) Update

func (t *StructureNode) Update(parts []string) bool

type Tree

type Tree struct {
	Root StructureNode `json:"root"`
}

func (*Tree) Structure

func (t *Tree) Structure() []StructureNode

func (*Tree) Update

func (t *Tree) Update(request *http.Request) bool

type Workspace

type Workspace struct {
	ID                string               `json:"id"`
	Name              string               `json:"name"`
	Scope             Scope                `json:"scope"`
	InterceptionScope Scope                `json:"interception_scope"`
	Collection        Collection           `json:"collection"`
	Tree              Tree                 `json:"tree"`
	Workflows         []workflow.WorkflowM `json:"workflows"`
	// contains filtered or unexported fields
}

func List

func List(logger *log.Logger) ([]*Workspace, error)

func Load

func Load(id string) (*Workspace, error)

func New

func New() *Workspace

func (*Workspace) Save

func (w *Workspace) Save() error

func (*Workspace) UpdateTree

func (w *Workspace) UpdateTree(request *http.Request) (*Tree, bool)

Jump to

Keyboard shortcuts

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