httpserver

package
v1.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const KBAgentDefaultConcurrency = 10
View Source
const KBAgentDefaultPort = 3501

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Port             int
	Address          string
	ConCurrency      int
	UnixDomainSocket string
	APILogging       bool
}

type Endpoint

type Endpoint struct {
	Method string
	Route  string

	// Version represents the version of the API, which is currently v1.0.
	// the version is introduced to allow breaking changes.
	// If the API is upgraded to v2.0, the v1.0 API will be maintained
	// for compatibility until all legacy accesses are removed.
	Version string

	// LegacyRoute is used When the API is upgraded, some old APIs may
	// need to update their path routes. To ensure compatibility,
	// the old paths can be set as legacyRoute.
	LegacyRoute string
	Handler     fasthttp.RequestHandler
}

func Endpoints

func Endpoints() []Endpoint

type ErrorResponse

type ErrorResponse struct {
	ErrorCode string `json:"errorCode"`
	Message   string `json:"message"`
}

ErrorResponse is an HTTP response message sent back to calling clients.

func NewErrorResponse

func NewErrorResponse(errorCode, message string) ErrorResponse

NewErrorResponse returns a new ErrorResponse.

type Request

type Request struct {
	Action     string         `json:"action"`
	Data       interface{}    `json:"data,omitempty"`
	Parameters map[string]any `json:"parameters,omitempty"`
}

type Server

type Server interface {
	io.Closer
	Router() fasthttp.RequestHandler
	StartNonBlocking() error
}

Server is an interface for the kb-agent HTTP server.

func NewServer

func NewServer() Server

NewServer returns a new HTTP server.

Jump to

Keyboard shortcuts

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