Documentation
¶
Index ¶
- Variables
- type AcmeServer
- type BasePinger
- type BaseRouter
- type BaseStore
- type Container
- type ContainerType
- type DockerWatcher
- type DockerWatcherConfig
- type Domains
- type Endpoints
- type Paths
- type Pinger
- type PolicyManager
- type Processor
- type ProcessorPathAppend
- type ProcessorPathReplace
- type Recipe
- type Rule
- type Rules
- type Service
- type Services
- type Store
- type Watcher
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AcmeServer ¶
type AcmeServer struct {
// contains filtered or unexported fields
}
AcmeServer contains all logic to handle both on port http and https
func NewAcmeServer ¶
func NewAcmeServer(policyManager PolicyManager, certPath string) *AcmeServer
NewAcmeServer creates acme.Server
type BasePinger ¶
type BasePinger struct {
// contains filtered or unexported fields
}
func NewBasePinger ¶
func NewBasePinger(watcher Watcher) *BasePinger
func (*BasePinger) Service ¶
func (p *BasePinger) Service() (*Service, error)
Service calls each available container and create a service object
type BaseRouter ¶
type BaseRouter struct {
// contains filtered or unexported fields
}
func NewBaseRouter ¶
func NewBaseRouter(store Store) *BaseRouter
func (*BaseRouter) AddProcessor ¶
func (r *BaseRouter) AddProcessor(name string, builder func(config json.RawMessage) (Processor, error)) *BaseRouter
func (*BaseRouter) HostPolicy ¶
func (br *BaseRouter) HostPolicy(ctx context.Context, host string) error
func (*BaseRouter) ServeHTTP ¶
func (br *BaseRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)
type BaseStore ¶
type BaseStore struct {
// contains filtered or unexported fields
}
func NewBaseStore ¶
NewBaseStore creates BaseStore object
type Container ¶
type Container struct {
// Unique ID generated by container orcestration
ID string
// Type shows what type of container it is
Type ContainerType
// Active show wheather container is added or removed
Active bool
// RemoteAddr is IP:PORT which container is listening to
RemoteAddr net.Addr
// ConfigPath is the path to extract config data
ConfigPath string
// Err if error detected by orcestration system, it pass it here. In most case it means that Container is dead
Err error
}
Container is piece of object which contains information about each Node or Container
type ContainerType ¶
type ContainerType string
ContainerType defines which watcher produce them
const ( // DockerContainer defines by docker driver DockerContainer ContainerType = "docker" )
type DockerWatcher ¶
type DockerWatcher struct {
// contains filtered or unexported fields
}
func NewDockerWatcher ¶
func NewDockerWatcher(config DockerWatcherConfig) *DockerWatcher
func (*DockerWatcher) Container ¶
func (d *DockerWatcher) Container() (*Container, error)
func (*DockerWatcher) Start ¶
func (d *DockerWatcher) Start() error
Start is a blocking call, the caller for this method should run in a separate go routine
NOTE: upon on returning this function, the internal channel will be closed, if a restart requires, a new instance of DockerWatcher needs to be instantiated
type DockerWatcherConfig ¶
type Domains ¶
type Domains struct {
// contains filtered or unexported fields
}
func NewDomains ¶
func NewDomains() *Domains
type Endpoints ¶
type Endpoints struct {
// contains filtered or unexported fields
}
func NewEndpoints ¶
func NewEndpoints() *Endpoints
type Pinger ¶
type Pinger interface {
// Service if service returns an nil value, it means that Pinger has
// some internal error and it will no longer return service
Service() (*Service, error)
}
Pinger defines how container can be ping to get extra information and construct Service object
type PolicyManager ¶
PolicyManager is a
type Processor ¶
type Processor interface {
Request(r *http.Request)
Response(r *http.Response) error
HandleError(rw http.ResponseWriter, r *http.Request, err error)
}
func CreateProcessorPathAppend ¶
func CreateProcessorPathAppend(raw json.RawMessage) (Processor, error)
func CreateProcessorPathReplace ¶
func CreateProcessorPathReplace(raw json.RawMessage) (Processor, error)
type ProcessorPathAppend ¶
func (*ProcessorPathAppend) HandleError ¶
func (p *ProcessorPathAppend) HandleError(w http.ResponseWriter, r *http.Request, err error)
func (*ProcessorPathAppend) Request ¶
func (p *ProcessorPathAppend) Request(r *http.Request)
type ProcessorPathReplace ¶
type ProcessorPathReplace struct {
Search string `json:"search"`
Replace string `json:"replace"`
Times int `json:"times"`
}
func (*ProcessorPathReplace) HandleError ¶
func (p *ProcessorPathReplace) HandleError(w http.ResponseWriter, r *http.Request, err error)
func (*ProcessorPathReplace) Request ¶
func (p *ProcessorPathReplace) Request(r *http.Request)
type Recipe ¶
type Recipe struct {
Name string `json:"name"`
Config json.RawMessage `json:"config"`
}
type Rule ¶
type Rule struct {
Domain string `json:"domain"`
Path string `json:"path"`
Ready bool `json:"ready"`
Recipes []*Recipe `json:"recipes"`
}
Rule contains basic information about domain, path and availability of each container
type Rules ¶
type Rules []*Rule
Rules a wrapper around array of Rule to make it simpler to work with array of rules
type Service ¶
Service is a set of configuration that points to a specific running container Each container can have multiple services linked to them
type Services ¶
type Services struct {
// contains filtered or unexported fields
}
func NewServices ¶
func NewServices() *Services