cop

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCoper

func NewCoper(getter kv.Getter) types.Copuser

Types

type Client

type Client struct {
	Endpoint string
}

func (*Client) AddService

func (c *Client) AddService(service Service) error

type Cop

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

func New

func New(config CopConfig) *Cop

func NewNoOp

func NewNoOp() *Cop

func (*Cop) GetRule

func (c *Cop) GetRule(r chi.Router) (string, error)

func (*Cop) RegisterChi

func (c *Cop) RegisterChi(r chi.Router) error

func (*Cop) RegisterGojiEndpoint

func (c *Cop) RegisterGojiEndpoint(endpoint, method string) error

func (*Cop) WithLog

func (c *Cop) WithLog(log *logan.Entry) types.Copus

type CopConfig

type CopConfig struct {
	Endpoint      string `fig:"endpoint,required"`
	Upstream      string `fig:"upstream,required"`
	ServiceName   string `fig:"service_name,required"`
	ServicePort   string `fig:"service_port,required"`
	ServicePrefix string `fig:"service_prefix"`
}

type Service

type Service struct {
	Data ServiceData `json:"data"`
}

type ServiceAttributes

type ServiceAttributes struct {
	Name string `json:"name"`
	Port string `json:"port"`
	Rule string `json:"rule"`
	Url  string `json:"url"`
}

type ServiceData

type ServiceData struct {
	ID         string            `json:"id"`
	Type       string            `json:"type"`
	Attributes ServiceAttributes `json:"attributes"`
}

Jump to

Keyboard shortcuts

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