vhost

package
v0.0.0-...-bd20790 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHttpRequestInfo

func GetHttpRequestInfo(c *conn.Conn) (_ net.Conn, _ map[string]string, err error)

func GetHttpsHostname

func GetHttpsHostname(c *conn.Conn) (sc net.Conn, _ map[string]string, err error)

func HttpAuthFunc

func HttpAuthFunc(c *conn.Conn, userName, passWord, authorization string) (bAccess bool, err error)

func HttpHostNameRewrite

func HttpHostNameRewrite(c *conn.Conn, rewriteHost string) (_ net.Conn, err error)

Types

type ByLocation

type ByLocation []*VhostRouter

sort by location

func (ByLocation) Len

func (a ByLocation) Len() int

func (ByLocation) Less

func (a ByLocation) Less(i, j int) bool

func (ByLocation) Swap

func (a ByLocation) Swap(i, j int)

type HttpMuxer

type HttpMuxer struct {
	*VhostMuxer
}

func NewHttpMuxer

func NewHttpMuxer(listener *conn.Listener, timeout time.Duration) (*HttpMuxer, error)

type HttpsMuxer

type HttpsMuxer struct {
	*VhostMuxer
}

func NewHttpsMuxer

func NewHttpsMuxer(listener *conn.Listener, timeout time.Duration) (*HttpsMuxer, error)

type Listener

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

func (*Listener) Accept

func (l *Listener) Accept() (*conn.Conn, error)

func (*Listener) Close

func (l *Listener) Close() error

func (*Listener) Name

func (l *Listener) Name() string

type VhostMuxer

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

func NewVhostMuxer

func NewVhostMuxer(listener *conn.Listener, vhostFunc muxFunc, authFunc httpAuthFunc, rewriteFunc hostRewriteFunc, timeout time.Duration) (mux *VhostMuxer, err error)

func (*VhostMuxer) Listen

func (v *VhostMuxer) Listen(name, location, rewriteHost, userName, passWord string) (l *Listener, err error)

listen for a new domain name, if rewriteHost is not empty and rewriteFunc is not nil, then rewrite the host header to rewriteHost

type VhostRouter

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

type VhostRouters

type VhostRouters struct {
	RouterByDomain map[string][]*VhostRouter
	// contains filtered or unexported fields
}

func NewVhostRouters

func NewVhostRouters() *VhostRouters

func (*VhostRouters) Add

func (r *VhostRouters) Add(domain, location string, l *Listener)

func (*VhostRouters) Del

func (r *VhostRouters) Del(domain, location string)

func (*VhostRouters) Exist

func (r *VhostRouters) Exist(host, path string) (vr *VhostRouter, exist bool)

func (*VhostRouters) Get

func (r *VhostRouters) Get(host, path string) (vr *VhostRouter, exist bool)

Jump to

Keyboard shortcuts

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