halp
This commit is contained in:
@@ -35,7 +35,7 @@ func NewConfig() (Config, error) {
|
|||||||
fs.StringVar(&c.Cert.CRT, "crt", "", "path to .crt")
|
fs.StringVar(&c.Cert.CRT, "crt", "", "path to .crt")
|
||||||
fs.StringVar(&c.Cert.Key, "key", "", "path to .key")
|
fs.StringVar(&c.Cert.Key, "key", "", "path to .key")
|
||||||
fs.IntVar(&c.Port, "p", 56112, "port to listen on")
|
fs.IntVar(&c.Port, "p", 56112, "port to listen on")
|
||||||
f := fs.String("f", "/dev/null", `file of {domains:{com:{google:{to: scheme://host:port, basicAuth: u:p, redir: false}}}}`)
|
f := fs.String("f", "/dev/null", `file of {domains:{.google.com:{mail:{to: scheme://host:port, basicAuth: u:p, redir: false}}}}`)
|
||||||
if err := fs.Parse(os.Args[1:]); err != nil {
|
if err := fs.Parse(os.Args[1:]); err != nil {
|
||||||
return c, err
|
return c, err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,8 +175,7 @@ func (c Config) basicAuth(w http.ResponseWriter, r *http.Request) bool {
|
|||||||
|
|
||||||
func (c Config) endpoint(r *http.Request) Endpoint {
|
func (c Config) endpoint(r *http.Request) Endpoint {
|
||||||
key := c.key(r)
|
key := c.key(r)
|
||||||
domain := strings.TrimPrefix(r.Host, key)
|
domain := strings.Split(strings.TrimPrefix(r.Host, key), ":")[0]
|
||||||
log.Printf("lookup %s.%s", domain, key)
|
|
||||||
m, ok := c.Domains[domain]
|
m, ok := c.Domains[domain]
|
||||||
if !ok {
|
if !ok {
|
||||||
return Endpoint{}
|
return Endpoint{}
|
||||||
|
|||||||
Reference in New Issue
Block a user