specs

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2024 License: GPL-3.0 Imports: 6 Imported by: 5

Documentation

Overview

Copyright © 2021-2023 Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2021 Funtoo Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2021 Funtoo Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2021 Funtoo Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2021-2022 Funtoo Macaroni OS Linux See AUTHORS and LICENSE for the license details and contributors.

Index

Constants

View Source
const (
	RGuardVersion = "0.6.1"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RestArtefact added in v0.5.0

type RestArtefact struct {
	Path    string `json:"path,omitempty" yaml:"path,omitempty" mapstructure:"path,omitempty"`
	Size    int64  `json:"size,omitempty" yaml:"size,omitempty" mapstructure:"size,omitempty"`
	Md5     string `json:"md5,omitempty" yaml:"md5,omitempty" mapstructure:"md5,omitempty"`
	Sha512  string `json:"sha512,omitempty" yaml:"sha512,omitempty" mapstructure:"sha512,omitempty"`
	Blake2b string `json:"blake2b,omitempty" yaml:"blake2b,omitempty" mapstructure:"blake2b,omitempty"`
}

type RestGuardConfig

type RestGuardConfig struct {
	UserAgent string `json:"user_agent,omitempty" yaml:"user_agent,omitempty" mapstructure:"user_agent,omitempty,omitempty"`

	ReqsTimeout         int  `json:"reqs_timeout,omitempty" yaml:"reqs_timeout,omitempty" mapstructure:"reqs_timeout,omitempty"`
	MaxIdleConns        int  `json:"max_idle_conns,omitempty" yaml:"max_idle_conns,omitempty" mapstructure:"max_idle_conns,omitempty"`
	IdleConnTimeout     int  `json:"idle_conn_timeout,omitempty" yaml:"idle_conn_timeout,omitempty" mapstructure:"idle_conn_timeout,omitempty"`
	MaxConnsPerHost     int  `json:"max_conns4host,omitempty" yaml:"max_conns4host,omitempty" mapstructure:"max_conns4host,omitempty"`
	MaxIdleConnsPerHost int  `json:"max_idleconns4host,omitempty" yaml:"max_idleconns4host,omitempty" mapstructure:"max_idleconns4host,omitempty"`
	DisableCompression  bool `json:"disable_compression,omitempty" yaml:"disable_compression,omitempty" mapstructure:"disable_compression,omitempty"`
	InsecureSkipVerify  bool `json:"insecure_skip_verify,omitempty" yaml:"insecure_skip_verify,omitempty" mapstructure:"insecure_skip_verify,omitempty"`
}

func NewConfig

func NewConfig() *RestGuardConfig

type RestNode

type RestNode struct {
	Name    string `json:"name" yaml:"name" mapstructure:"name"`
	Disable bool   `json:"disable,omitempty" yaml:"disable,omitempty" mapstructure:"disable,omitempty"`
	BaseUrl string `json:"base_url" yaml:"base_url" mapstructure:"base_url"`
	Schema  string `json:"schema,omitempty" yaml:"schema,omitempty" mapstructure:"schema,omitempty"`
	Ssl     bool   `json:"ssl,omitempty" yaml:"ssl,omitempty" mapstructure:"ssl,omitempty"`
}

func NewRestNode

func NewRestNode(name, burl string, ssl bool) *RestNode

func (*RestNode) Equal

func (n *RestNode) Equal(o *RestNode) bool

func (*RestNode) GetUrlPrefix

func (n *RestNode) GetUrlPrefix() string

func (*RestNode) IsActive added in v0.4.0

func (n *RestNode) IsActive() bool

func (*RestNode) SetDisable added in v0.4.0

func (n *RestNode) SetDisable(b bool)

type RestNodes

type RestNodes []*RestNode

func (RestNodes) HasNode

func (nn RestNodes) HasNode(n *RestNode) bool

type RestService

type RestService struct {
	Name            string      `json:"name" yaml:"name" mapstructure:"name"`
	Nodes           []*RestNode `json:"nodes" yaml:"nodes" mapstructure:"nodes"`
	Retries         int         `json:"retries,omitempty" yaml:"retries,omitempty" mapstructure:"retries,omitempty"`
	RetryIntervalMs int         `json:"retry_interval_ms,omitempty" yaml:"retry_interval_ms,omitempty" mapstructure:"retry_interval_ms,omitempty"`

	Options map[string]string `json:"options,omitempty" yaml:"options,omitempty" mapstructure:"options,omitempty"`

	RespValidatorCb func(t *RestTicket) (bool, error) `json:"-" yaml:"-" mapstructure:"-"`
}

func NewRestService

func NewRestService(n string) *RestService

func (*RestService) AddNode

func (s *RestService) AddNode(n *RestNode)

func (*RestService) Clone

func (s *RestService) Clone() *RestService

func (*RestService) GetName

func (s *RestService) GetName() string

func (*RestService) GetNodes

func (s *RestService) GetNodes() []*RestNode

func (*RestService) GetOption

func (s *RestService) GetOption(k string) (string, error)

func (*RestService) GetTicket

func (s *RestService) GetTicket() *RestTicket

func (*RestService) HasOption

func (s *RestService) HasOption(k string) bool

func (*RestService) SetName

func (s *RestService) SetName(n string)

func (*RestService) SetOption

func (s *RestService) SetOption(k, v string)

type RestTicket

type RestTicket struct {
	Id          string         `json:"id,omitempty" yaml:"id,omitempty" mapstructure:"id,omitempty"`
	Request     *http.Request  `json:"req,omitempty" yaml:"req,omitempty" mapstructure:"req,omitempty"`
	Response    *http.Response `json:"resp,omitempty" yaml:"resp,omitempty" mapstructure:"resp,omitempty"`
	Path        string         `json:"path,omitempty" yaml:"path,omitempty" mapstructure:"path,omitempty"`
	Retries     int            `json:"retries,omitempty" yaml:"retries,omitempty" mapstructure:"retries,omitempty"`
	Service     *RestService   `json:"service,omitempty" yaml:"service,omitempty" mapstructure:"service,omitempty"`
	Node        *RestNode      `json:"node,omitempty" yaml:"node,omitempty" mapstructure:"node,omitempty"`
	FailedNodes RestNodes      `json:"failed_nodes,omitempty" yaml:"failed_nodes,omitempty" mapstructure:"failed_nodes,omitempty"`

	RequestBodyCb  func(t *RestTicket) (bool, io.ReadCloser, error) `json:"-" yaml:"-" mapstructure:"-"`
	RequestCloseCb func(t *RestTicket)                              `json:"-" yaml:"-" mapstructure:"-"`
	Closure        map[string]interface{}                           `json:"-" yaml:"-" mapstructure:"-"`
}

func (*RestTicket) AddFail

func (t *RestTicket) AddFail(n *RestNode)

func (*RestTicket) GetClosure added in v0.2.0

func (t *RestTicket) GetClosure(name string) (interface{}, bool)

func (*RestTicket) GetId

func (t *RestTicket) GetId() string

func (*RestTicket) GetNode

func (t *RestTicket) GetNode() *RestNode

func (*RestTicket) GetRequest

func (t *RestTicket) GetRequest() *http.Request

func (*RestTicket) GetRequestBodyCb

func (t *RestTicket) GetRequestBodyCb() func(t *RestTicket) (bool, io.ReadCloser, error)

func (*RestTicket) GetRequestCloseCb added in v0.2.0

func (t *RestTicket) GetRequestCloseCb() func(t *RestTicket)

func (*RestTicket) GetResponse

func (t *RestTicket) GetResponse() *http.Response

func (*RestTicket) GetResponseStatusCode added in v0.2.2

func (t *RestTicket) GetResponseStatusCode(defStatusCode int) int

Facility function to get HTTP response status code or a default code if the response is not available.

func (*RestTicket) GetRetries

func (t *RestTicket) GetRetries() int

func (*RestTicket) GetService

func (t *RestTicket) GetService() *RestService

func (*RestTicket) Rip

func (t *RestTicket) Rip()

func (*RestTicket) SetClosure added in v0.2.0

func (t *RestTicket) SetClosure(name string, c interface{})

func (*RestTicket) SetRequestCloseCb added in v0.2.0

func (t *RestTicket) SetRequestCloseCb(c func(t *RestTicket))

Jump to

Keyboard shortcuts

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