Documentation
¶
Index ¶
- Variables
- func GetProtoHostPort(name string) (proto, host, port string, err error)
- func IsIp4(s string) bool
- func NoWild(host string) (rv string)
- type CacheIP
- type CacheIPData
- type IpToHostPort
- type NameResolve
- func (nr *NameResolve) AddDefault(proto, port string, hdlr http.Handler, id int) (e error)
- func (nr *NameResolve) AddName(namePattern string, hdlr http.Handler, id int, addrIfNone string) (e error)
- func (nr *NameResolve) GetHandler(name string) (rv *IpToHostPort, ok bool)
- func (nr *NameResolve) GetRawTopHandler(listen string) (Handler http.Handler, err error)
- func (nr *NameResolve) ServeHTTP(www http.ResponseWriter, req *http.Request)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDuplicateNameResolve = errors.New("Each name must resolve to a unique set of rules - duplciate found")
View Source
var ErrUnableToParse = errors.New("Unable to parse url")
Functions ¶
func GetProtoHostPort ¶
Types ¶
type CacheIP ¶
type CacheIP struct { Data map[string]CacheIPData // contains filtered or unexported fields }
var CIp CacheIP
type CacheIPData ¶
type CacheIPData struct { IP []net.IP When time.Time // When saved // contains filtered or unexported fields }
IPs, err := net.LookupIP(host) // xyzzy - fast enough - need to cache?
type IpToHostPort ¶
type NameResolve ¶
type NameResolve struct { IpLookup map[string]map[string]*IpToHostPort // RawLookup map[string]*IpToHostPort Debug1 bool // Debug2 bool // Use In: func GetProtoHostPort(name string) (proto, host, port string, err error) Debug3 bool // Debug4 bool // Debug5 bool // // contains filtered or unexported fields }
func NewNameResolve ¶
func NewNameResolve() *NameResolve
func (*NameResolve) AddDefault ¶
func (*NameResolve) GetHandler ¶
func (nr *NameResolve) GetHandler(name string) (rv *IpToHostPort, ok bool)
This is the name matcher for HTTP requests - it returns the correct handler. This means that if we are to dynamically configure - then this is the place to do it - We could use the "Id" to re-lookup (index) the handler from a table and pull it out Every time - that alone would lead to all new connections are based on new config.
name may be bob.test1.com - and match to bob.test1.com, if not look for *.test1.com, then *.*.com, then *.com
func (*NameResolve) GetRawTopHandler ¶
func (nr *NameResolve) GetRawTopHandler(listen string) (Handler http.Handler, err error)
p1, err := bot.GetRawTopHandler ( listen );
func (*NameResolve) ServeHTTP ¶
func (nr *NameResolve) ServeHTTP(www http.ResponseWriter, req *http.Request)
Click to show internal directories.
Click to hide internal directories.