daemon

package
v0.0.0-...-b038a85 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: AGPL-3.0 Imports: 30 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	WiretapServiceChan      = "wiretap"
	WiretapBroadcastChan    = "wiretap-broadcast"
	WiretapStaticChangeChan = "wiretap-static-change"
	IncomingHttpRequest     = "incoming-http-request"
)

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware() mux.MiddlewareFunc

func CloneExistingRequest

func CloneExistingRequest(request CloneRequest) *http.Request

func CloneExistingResponse

func CloneExistingResponse(r *http.Response) *http.Response

func ExtractHeaders

func ExtractHeaders(resp *http.Response) map[string]any

func MonitorStatic

func MonitorStatic(wiretapConfig *shared.WiretapConfiguration)

func ReconstructURL

func ReconstructURL(r *http.Request, protocol, host, basepath string, port string) string

func ReplaceWithVariables

func ReplaceWithVariables(variables map[string]*shared.CompiledVariable, input string) string

Types

type CloneRequest

type CloneRequest struct {
	Request       *http.Request
	Protocol      string
	Host          string
	BasePath      string
	Port          string
	PathTarget    string
	DropHeaders   []string
	InjectHeaders map[string]string
	Auth          string
	Variables     map[string]*shared.CompiledVariable
}

type FormFile

type FormFile struct {
	Name    string               `json:"name,omitempty"`
	Headers textproto.MIMEHeader `json:"headers,omitempty"`
	Data    string               `json:"data,omitempty"`
}

type FormPart

type FormPart struct {
	Name  string      `json:"name,omitempty"`
	Value []string    `json:"value,omitempty"`
	Files []*FormFile `json:"files,omitempty"`
}

type HttpCookie

type HttpCookie struct {
	Value   string `json:"value,omitempty"`
	Path    string `json:"path,omitempty"`
	Domain  string `json:"domain,omitempty"`
	Expires string `json:"expires,omitempty"`
	// MaxAge=0 means no 'Max-Age' attribute specified.
	// MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'
	// MaxAge>0 means Max-Age attribute present and given in seconds
	MaxAge   int  `json:"maxAge,omitempty"`
	Secure   bool `json:"secure,omitempty"`
	HttpOnly bool `json:"httpOnly,omitempty"`
}

type HttpRequest

type HttpRequest struct {
	Timestamp       int64                  `json:"timestamp,omitempty"`
	URL             string                 `json:"url,omitempty"`
	Method          string                 `json:"method,omitempty"`
	Host            string                 `json:"host,omitempty"`
	Path            string                 `json:"path,omitempty"`
	OriginalPath    string                 `json:"originalPath,omitempty"`
	DroppedHeaders  []string               `json:"droppedHeaders,omitempty"`
	InjectedHeaders map[string]string      `json:"injectedHeaders,omitempty"`
	Query           string                 `json:"query,omitempty"`
	Headers         map[string]any         `json:"headers,omitempty"`
	Body            string                 `json:"requestBody,omitempty"`
	Cookies         map[string]*HttpCookie `json:"cookies,omitempty"`
}

type HttpResponse

type HttpResponse struct {
	Timestamp  int64                  `json:"timestamp,omitempty"`
	Headers    map[string]any         `json:"headers,omitempty"`
	StatusCode int                    `json:"statusCode,omitempty"`
	Body       string                 `json:"responseBody,omitempty"`
	Cookies    map[string]*HttpCookie `json:"cookies,omitempty"`
	Time       time.Time              `json:"-"`
}

type HttpTransaction

type HttpTransaction struct {
	Request            *HttpRequest              `json:"httpRequest,omitempty"`
	RequestValidation  []*errors.ValidationError `json:"requestValidation,omitempty"`
	Response           *HttpResponse             `json:"httpResponse,omitempty"`
	ResponseValidation []*errors.ValidationError `json:"responseValidation,omitempty"`
	Id                 string                    `json:"id,omitempty"`
}

func BuildHttpTransaction

func BuildHttpTransaction(build HttpTransactionConfig) *HttpTransaction

func BuildResponse

func BuildResponse(r *model.Request, response *http.Response) *HttpTransaction

type HttpTransactionConfig

type HttpTransactionConfig struct {
	OriginalRequest   *http.Request
	NewRequest        *http.Request
	ID                *uuid.UUID
	TransactionConfig *shared.WiretapConfiguration
}

type WiretapService

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

func NewWiretapService

func NewWiretapService(document libopenapi.Document, config *shared.WiretapConfiguration) *WiretapService

func (*WiretapService) HandleHttpRequest

func (ws *WiretapService) HandleHttpRequest(request *model.Request)

func (*WiretapService) HandleServiceRequest

func (ws *WiretapService) HandleServiceRequest(request *model.Request, core service.FabricServiceCore)

func (*WiretapService) Init

Jump to

Keyboard shortcuts

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