hostmgr

package
v0.0.0-...-9d84085 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Host

type Host struct {
	Address      string // e.g. "host:port" or ":port" for localhost port
	ReverseProxy *httputil.ReverseProxy
}

Host represents a target host of a proxy

type HostManager

type HostManager interface {
	PutHost(sni string, addr string, rp *httputil.ReverseProxy) error
	GetHost(sni string) (*Host, bool, error)
	RemoveHost(sni string) error
}

HostManager represents the host-management functionality required of a multiple-host proxy

type InMemoryHostManager

type InMemoryHostManager struct {
	sync.RWMutex // inherit read/write lock behavior
	// contains filtered or unexported fields
}

InMemoryHostManager is an in-memory implementation of the HostManager iface

func NewInMemoryHostManager

func NewInMemoryHostManager() *InMemoryHostManager

NewInMemoryHostManager is the InMemoryHostManager constructor

func (*InMemoryHostManager) GetHost

func (s *InMemoryHostManager) GetHost(sni string) (*Host, bool, error)

GetHost looks-up the target host for a given server name

func (*InMemoryHostManager) PutHost

func (s *InMemoryHostManager) PutHost(
	sni string,
	addr string,
	rp *httputil.ReverseProxy,
) error

PutHost adds/updates the target host for a given server name

func (*InMemoryHostManager) RemoveHost

func (s *InMemoryHostManager) RemoveHost(sni string) error

RemoveHost removes the target host for a given server name

Jump to

Keyboard shortcuts

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