gateway

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-3.0 Imports: 3 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

Overview

Package gateway provides a protocol-aware API gateway.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Listen string  `json:"listen"`
	Routes []Route `json:"routes"`
}

Config holds gateway configuration.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns a default gateway configuration.

type Gateway

type Gateway struct {
	Config *Config
}

Gateway represents a protocol API gateway.

func NewGateway

func NewGateway(cfg *Config) *Gateway

NewGateway creates a new gateway.

func (*Gateway) Describe

func (g *Gateway) Describe() string

Describe returns a description of the gateway configuration.

func (*Gateway) ExportConfig

func (g *Gateway) ExportConfig() string

ExportConfig exports the gateway config as JSON.

type Route

type Route struct {
	Path      string    `json:"path"`
	Protocol  string    `json:"protocol"`
	Type      RouteType `json:"type"`
	RateLimit int       `json:"rate_limit,omitempty"`
	AuthReq   bool      `json:"auth_required"`
}

Route defines a gateway route.

type RouteType

type RouteType string

RouteType represents a protocol conversion route type.

const (
	RouteBinaryToJSON RouteType = "binary_to_json"
	RouteJSONToBinary RouteType = "json_to_binary"
	RoutePassthrough  RouteType = "passthrough"
)

Jump to

Keyboard shortcuts

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