core

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalResolvedRoute added in v0.5.0

func MarshalResolvedRoute(route ResolvedRoute) ([]byte, error)

MarshalResolvedRoute takes a ResolvedRoute implementation, serializes it, and then wraps it in a resolvedRouteWrapper so that we can determine which type of xRoute to return on deserialization.

Types

type CommonRoute

type CommonRoute struct {
	Meta      map[string]string
	Name      string
	Namespace string
}

func (CommonRoute) GetMeta

func (c CommonRoute) GetMeta() map[string]string

func (CommonRoute) GetName

func (c CommonRoute) GetName() string

func (CommonRoute) GetNamespace

func (c CommonRoute) GetNamespace() string

type GatewayID

type GatewayID struct {
	ConsulNamespace string
	Service         string
}

type HTTPFilter

type HTTPFilter struct {
	Type       HTTPFilterType
	Header     HTTPHeaderFilter
	Redirect   HTTPRedirectFilter
	URLRewrite HTTPURLRewriteFilter
}

type HTTPFilterType

type HTTPFilterType string
const (
	HTTPHeaderFilterType     HTTPFilterType = "HTTPHeaderFilter"
	HTTPRedirectFilterType   HTTPFilterType = "HTTPRedirectFilter"
	HTTPURLRewriteFilterType HTTPFilterType = "HTTPURLRewriteFilter"
)

type HTTPHeaderFilter

type HTTPHeaderFilter struct {
	Set    map[string]string
	Add    map[string]string
	Remove []string
}

type HTTPHeaderMatch

type HTTPHeaderMatch struct {
	Type  HTTPHeaderMatchType
	Name  string
	Value string
}

type HTTPHeaderMatchType

type HTTPHeaderMatchType string
const (
	HTTPHeaderMatchNoneType              HTTPHeaderMatchType = ""
	HTTPHeaderMatchExactType             HTTPHeaderMatchType = "HTTPHeaderMatchExact"
	HTTPHeaderMatchPrefixType            HTTPHeaderMatchType = "HTTPHeaderMatchPrefix"
	HTTPHeaderMatchSuffixType            HTTPHeaderMatchType = "HTTPHeaderMatchSuffix"
	HTTPHeaderMatchPresentType           HTTPHeaderMatchType = "HTTPHeaderMatchPresent"
	HTTPHeaderMatchRegularExpressionType HTTPHeaderMatchType = "HTTPHeaderMatchRegularExpression"
)

type HTTPMatch

type HTTPMatch struct {
	Path    HTTPPathMatch
	Headers []HTTPHeaderMatch
	Query   []HTTPQueryMatch
	Method  HTTPMethod
}

type HTTPMethod

type HTTPMethod string
const (
	HTTPMethodNone    HTTPMethod = ""
	HTTPMethodConnect HTTPMethod = "CONNECT"
	HTTPMethodDelete  HTTPMethod = "DELETE"
	HTTPMethodGet     HTTPMethod = "GET"
	HTTPMethodHead    HTTPMethod = "HEAD"
	HTTPMethodOptions HTTPMethod = "OPTIONS"
	HTTPMethodPatch   HTTPMethod = "PATCH"
	HTTPMethodPost    HTTPMethod = "POST"
	HTTPMethodPut     HTTPMethod = "PUT"
	HTTPMethodTrace   HTTPMethod = "TRACE"
)

type HTTPPathMatch

type HTTPPathMatch struct {
	Type  HTTPPathMatchType
	Value string
}

type HTTPPathMatchType

type HTTPPathMatchType string
const (
	HTTPPathMatchNoneType              HTTPPathMatchType = ""
	HTTPPathMatchExactType             HTTPPathMatchType = "HTTPPathMatchExact"
	HTTPPathMatchPrefixType            HTTPPathMatchType = "HTTPPathMatchPrefix"
	HTTPPathMatchRegularExpressionType HTTPPathMatchType = "HTTPPathMatchRegularExpression"
)

type HTTPQueryMatch

type HTTPQueryMatch struct {
	Type  HTTPQueryMatchType
	Name  string
	Value string
}

type HTTPQueryMatchType

type HTTPQueryMatchType string
const (
	HTTPQueryMatchNoneType              HTTPQueryMatchType = ""
	HTTPQueryMatchExactType             HTTPQueryMatchType = "HTTPQueryMatchExact"
	HTTPQueryMatchPresentType           HTTPQueryMatchType = "HTTPQueryMatchPresent"
	HTTPQueryMatchRegularExpressionType HTTPQueryMatchType = "HTTPQueryMatchRegularExpression"
)

type HTTPRedirectFilter

type HTTPRedirectFilter struct {
	Scheme   string
	Hostname string
	Port     int
	Status   int
}

type HTTPRoute

type HTTPRoute struct {
	CommonRoute
	Hostnames []string
	Rules     []HTTPRouteRule
}

func (HTTPRoute) GetType

func (r HTTPRoute) GetType() ResolvedRouteType

type HTTPRouteBuilder

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

func NewHTTPRouteBuilder

func NewHTTPRouteBuilder() *HTTPRouteBuilder

func (*HTTPRouteBuilder) Build

func (b *HTTPRouteBuilder) Build() ResolvedRoute

func (*HTTPRouteBuilder) WithHostnames

func (b *HTTPRouteBuilder) WithHostnames(hostnames []string) *HTTPRouteBuilder

func (*HTTPRouteBuilder) WithMeta

func (b *HTTPRouteBuilder) WithMeta(meta map[string]string) *HTTPRouteBuilder

func (*HTTPRouteBuilder) WithName

func (b *HTTPRouteBuilder) WithName(name string) *HTTPRouteBuilder

func (*HTTPRouteBuilder) WithNamespace

func (b *HTTPRouteBuilder) WithNamespace(namespace string) *HTTPRouteBuilder

func (*HTTPRouteBuilder) WithRules

func (b *HTTPRouteBuilder) WithRules(rules []HTTPRouteRule) *HTTPRouteBuilder

type HTTPRouteRule

type HTTPRouteRule struct {
	Matches  []HTTPMatch
	Filters  []HTTPFilter
	Services []HTTPService
}

type HTTPService

type HTTPService struct {
	Service ResolvedService
	Weight  int32
	Filters []HTTPFilter
}

type HTTPURLRewriteFilter added in v0.4.0

type HTTPURLRewriteFilter struct {
	Type               URLRewriteType
	ReplacePrefixMatch string
}

type ResolvedGateway

type ResolvedGateway struct {
	ID             GatewayID
	Meta           map[string]string
	Listeners      []ResolvedListener
	MaxConnections *uint32
}

type ResolvedListener

type ResolvedListener struct {
	Name     string
	Hostname string
	Port     int
	Protocol string
	TLS      TLSParams
	Routes   []ResolvedRoute
}

type ResolvedRoute

type ResolvedRoute interface {
	GetType() ResolvedRouteType
	GetMeta() map[string]string
	GetName() string
	GetNamespace() string
}

func UnmarshalResolvedRoute added in v0.5.0

func UnmarshalResolvedRoute(b []byte) (ResolvedRoute, error)

UnmarshalResolvedRoute takes a serialized resolvedRouteWrapper and deserializes it into the appropriate ResolvedRoute implementation. It first partially deserializes to the wrapper in order to get the type and then deserializes the Data field into the target HTTPRoute or TCPRoute.

type ResolvedRouteType

type ResolvedRouteType string
const (
	ResolvedHTTPRouteType ResolvedRouteType = "HTTPRoute"
	ResolvedTCPRouteType  ResolvedRouteType = "TCPRoute"
)

type ResolvedService

type ResolvedService struct {
	ConsulNamespace string
	Service         string
}

type SyncAdapter

type SyncAdapter interface {
	Sync(ctx context.Context, gateway ResolvedGateway) (bool, error)
	Clear(ctx context.Context, id GatewayID) error
}

SyncAdapter is used for synchronizing store state to an external system

type TCPRoute

type TCPRoute struct {
	CommonRoute
	Service ResolvedService
}

func (TCPRoute) GetType

func (r TCPRoute) GetType() ResolvedRouteType

type TCPRouteBuilder

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

func NewTCPRouteBuilder

func NewTCPRouteBuilder() *TCPRouteBuilder

func (*TCPRouteBuilder) Build

func (b *TCPRouteBuilder) Build() ResolvedRoute

func (*TCPRouteBuilder) WithMeta

func (b *TCPRouteBuilder) WithMeta(meta map[string]string) *TCPRouteBuilder

func (*TCPRouteBuilder) WithName

func (b *TCPRouteBuilder) WithName(name string) *TCPRouteBuilder

func (*TCPRouteBuilder) WithNamespace

func (b *TCPRouteBuilder) WithNamespace(namespace string) *TCPRouteBuilder

func (*TCPRouteBuilder) WithService

func (b *TCPRouteBuilder) WithService(service ResolvedService) *TCPRouteBuilder

type TLSParams

type TLSParams struct {
	Enabled      bool
	MinVersion   string
	MaxVersion   string
	CipherSuites []string
	Certificates []string
}

type URLRewriteType added in v0.4.0

type URLRewriteType string
const (
	URLRewriteReplacePrefixMatchType URLRewriteType = "URLRewriteReplacePrefixMatch"
)

Jump to

Keyboard shortcuts

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