layer4

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// Servers are the servers to create. The key of each server must be
	// a unique name identifying the server for your own convenience;
	// the order of servers does not matter.
	Servers map[string]*Server `json:"servers,omitempty"`
}

App is a Kengine app that operates closest to layer 4 of the OSI model.

type Handler

type Handler interface {
	IAmAHandler()
}

type Match

type Match struct {
	TLS *MatchTLS `json:"tls,omitempty"`
}

Match . TODO: document

func (*Match) IsEmpty

func (m *Match) IsEmpty() bool

type MatchSNI

type MatchSNI []string

MatchSNI matches based on SNI (server name indication). ref; https://khulnasoft.com/docs/modules/tls.handshake_match.sni

type MatchTLS

type MatchTLS struct {
	SNI MatchSNI `json:"sni,omitempty"`
}

MatchTLS .

func (*MatchTLS) IsEmpty

func (m *MatchTLS) IsEmpty() bool

type Route

type Route struct {
	// Matchers define the conditions upon which to execute the handlers.
	// All matchers within the same set must match, and at least one set
	// must match; in other words, matchers are AND'ed together within a
	// set, but multiple sets are OR'ed together. No matchers matches all.
	MatcherSets []Match `json:"match,omitempty"`

	// Handlers define the behavior for handling the stream. They are
	// executed in sequential order if the route's matchers match.
	Handlers []Handler `json:"handle,omitempty"`
}

Route represents a collection of handlers that are gated by matching logic. A route is invoked if its matchers match the byte stream. In an equivalent "if...then" statement, matchers are like the "if" clause and handlers are the "then" clause: if the matchers match, then the handlers will be executed.

type RouteList

type RouteList []*Route

RouteList is a list of connection routes that can create a middleware chain. Routes are evaluated in sequential order: for the first route, the matchers will be evaluated, and if matched, the handlers invoked; and so on for the second route, etc.

type Server

type Server struct {
	// The network address to bind to. Any Kengine network address
	// is an acceptable value:
	// https://khulnasoft.com/docs/conventions#network-addresses
	Listen []string `json:"listen,omitempty"`

	// Routes express composable logic for handling byte streams.
	Routes RouteList `json:"routes,omitempty"`

	// Maximum time connections have to complete the matching phase (the first terminal handler is matched). Default: 3s.
	MatchingTimeout kengine.Duration `json:"matching_timeout,omitempty"`
}

Server represents a Kengine layer4 server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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