Documentation ¶
Index ¶
Constants ¶
View Source
const ( //ProtocolHTTP for http ProtocolHTTP = "http" //ProtocolHTTPS for http ProtocolHTTPS = "https" //ProtocolTCP for tcp ProtocolTCP = "tcp" //ProtocolUDP for udp ProtocolUDP = "udp" //ProtocolGrpc for grpc ProtocolGrpc = "grpc" )
Variables ¶
View Source
var ( //ErrNotExist data not exist err ErrNotExist = errors.New("resource does not exist") )
Functions ¶
This section is empty.
Types ¶
type BCSAuthOption ¶
BCSAuthOption for bkbcs-auth plugin
type HeaderOption ¶
type HeaderOption struct { //clean specified header Clean []string //Add more values Add map[string]string //Replace specified header Replace map[string]string }
HeaderOption for proxy rules that change http header
type Plugins ¶
type Plugins struct { HeadOption *HeaderOption AuthOption *BCSAuthOption }
Plugins holder for all gateway plugins
type Register ¶
type Register interface { //CreateService create Service interface, if service already exists, return error CreateService(svc *Service) error //UpdateService update specified Service, if service does not exist, return error UpdateService(svc *Service) error //GetService get specified service by name, if no service, return nil GetService(svc string) (*Service, error) //DeleteService delete specified service, success even if no such service DeleteService(svc *Service) error //ListServices get all existence services ListServices() ([]*Service, error) //GetTargetByService get service relative backends GetTargetByService(svc *Service) ([]Backend, error) //ReplaceTargetByService replace specified service backend list // so we don't care what original backend list are ReplaceTargetByService(svc *Service, backends []Backend) error //DeleteTargetByService clean all backend list for service DeleteTargetByService(svc *Service) error }
Register interface for gateway-discovery to registe all necessary bcs services to specified api-gateway
type Route ¶
type Route struct { //Name for route Name string //Prototol for frontend listenning, such as tcp, udp, http(s) Protocol string //Port for listen, if port is 0, use specified default tcp/udp/http port Port uint //Paths filter when protocol is http(s) Paths []string //PathRewrite rewrite path for http traffic PathRewrite bool //Header filter when using http(s) Header map[string]string //plugin Option for http modification Plugin *Plugins //Service relative svc name Service string Labels map[string]string }
Route inner data structure for traffics transffer. this model is used for frontend listenning or register
type Service ¶
type Service struct { Name string Protocol string Host string Port uint Retries int Path string Algorithm string //Option for plugin Plugin *Plugins //Routes several route can redirect traffics to same service Routes []Route Backends []Backend Labels map[string]string }
Service inner data structure for backend service
Click to show internal directories.
Click to hide internal directories.