models

package
v1.4.10 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteServiceByName

func DeleteServiceByName(name []byte) (bool, error)

DeleteServiceByName will find any service matching the name, and delete it, including any upstreams that are not referenced by other services.

func SaveUpstream

func SaveUpstream(upstream *Upstream, tx *bolt.Tx) error

SaveUpstream will persist an upstream to the database. This will check the database and update the upstream, if it already exists. Upstreams are unique by URL, so if the upstream was added to a different service, saving a change will update all services that shared this backend.

Types

type Service

type Service struct {
	Name      string      `json:"name"`
	Path      string      `json:"path"`
	Upstreams []*Upstream `json:"upstreams"`

	Registered time.Time `json:"registered"`
}

Service represents a single registered service with this reverse proxy.

func CreateService

func CreateService(service *Service) (*Service, error)

CreateService will create a new (or update an existing) service. If the service already exists, this call will update it with the new name, and append it's own upstream. This could be problematic if two different services register with the same path. The router would send traffic randomly to each.

func ListServices

func ListServices() ([]*Service, error)

ListServices returns a list of all available, known services. TODO this should cache and not always hit the disk.

type Upstream

type Upstream struct {
	URL string `json:"url"`

	IncludeServicePath bool `json:"include_service_path"`
	InsecureSkipVerify bool `json:"insecure_skip_verify"`
}

Upstream represents a single upstream that will be added to a service.

Jump to

Keyboard shortcuts

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