server

package
v0.1.1-0...-2e2e388 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	C chan struct{}
	// contains filtered or unexported fields
}

An Event is used to communicate that something has happened.

func NewEvent

func NewEvent() *Event

NewEvent creates a new Event.

func (*Event) Set

func (e *Event) Set()

Set sets the event by closing the C channel. After the first time, calls to set are a no-op.

func (*Event) Wait

func (e *Event) Wait(ctx context.Context)

Wait waits for the event to get set.

type Option

type Option func(*config)

An Option modifies the config.

func WithHost

func WithHost(host string) Option

WithHost sets the host to bind in the config.

func WithPort

func WithPort(port int) Option

WithPort sets the port in the config.

func WithTLSPort

func WithTLSPort(port int) Option

WithTLSPort sets the TLS port in the config.

type RoutingTable

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

A RoutingTable contains the information needed to route a request.

func NewRoutingTable

func NewRoutingTable(payload *watcher.Payload) *RoutingTable

NewRoutingTable creates a new RoutingTable.

func (*RoutingTable) GetBackend

func (rt *RoutingTable) GetBackend(host, path string) (*url.URL, error)

GetBackend gets the backend for the given host and path.

func (*RoutingTable) GetCertificate

func (rt *RoutingTable) GetCertificate(sni string) (*tls.Certificate, error)

GetCertificate gets a certificate.

type Server

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

A Server serves HTTP pages.

func New

func New(options ...Option) *Server

New 创建一个新的服务器

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run 启动服务器.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves an HTTP request.

func (*Server) Update

func (s *Server) Update(payload *watcher.Payload)

Update 更新路由表根据新的 Ingress 规则

Jump to

Keyboard shortcuts

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