Documentation
¶
Index ¶
Constants ¶
const MaxHeaderSize = 8 << 10 // 8KB
MaxHeaderSize represents the maximum size that the proxy will look throught to find a Host header
Variables ¶
var ( HeadersTooLarge = []byte("HTTP/1.0 413\r\nContent-Length: 0\r\nConnection: close\r\n\r\n") BadRequest = []byte("HTTP/1.0 400\r\nContent-Length: 0\r\nConnection: close\r\n\r\n") )
Two preconstructed responses to certain errors
var ( ErrIsDefault = errors.New("host is default") ErrProxyClosed = errors.New("proxy closed") )
Errors
var ( ErrInvalidHost = errors.New("invalid host") ErrRunning = errors.New("already running") ErrNotRunning = errors.New("not running") ErrNoDefault = errors.New("no default host set") )
Errors
var (
ErrBadSocket = errors.New("bad socket type")
)
Errors
Functions ¶
This section is empty.
Types ¶
type ErrAliasInUse ¶
type ErrAliasInUse struct {
Name string
}
ErrAliasInUse is an error returned when trying to give a host an alias already in use by another host
func (ErrAliasInUse) Error ¶
func (e ErrAliasInUse) Error() string
type ErrUnknownAlias ¶
type ErrUnknownAlias struct {
Name string
}
ErrUnknownAlias is an error returned when trying to remove an alias from a host where it is not set
func (ErrUnknownAlias) Error ¶
func (e ErrUnknownAlias) Error() string
type Host ¶
type Host struct {
// contains filtered or unexported fields
}
Host represents a single host and its aliases
func (*Host) AddAliases ¶
AddAliases simply adds aliases to the host
func (*Host) RemoveAlias ¶
RemoveAlias removes an alias from a host
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy repsents a listener that will proxy connections to hosts
func (*Proxy) Default ¶
Default sets the default host, one which will be used if a host cannot be determined from the headers
func (*Proxy) NewHost ¶
NewHost creates a new Host from the given command, setting up the proxied connections and running the command