iface string
port string
fqdn string
+ xport string
docroot string
idxpage string
header string
iface: "localhost",
port: "7070",
fqdn: "localhost",
+ xport: "7070",
docroot: ".",
idxpage: "index.goph",
header: "",
cfg.port = val
case "fqdn":
cfg.fqdn = val
+ case "xport":
+ cfg.xport = val
case "docroot":
cfg.docroot = val
case "idxpage":
flag.StringVar(&cfg.iface, "i", cfg.iface, "interface to bind to; empty for any")
flag.StringVar(&cfg.port, "p", cfg.port, "TCP `port` to listen on")
flag.StringVar(&cfg.fqdn, "f", cfg.fqdn, "fully qualified domain name")
+ flag.StringVar(&cfg.xport, "x", cfg.xport, "TCP port for generated links")
flag.StringVar(&cfg.docroot, "r", cfg.docroot, "document root `directory`")
flag.StringVar(&cfg.idxpage, "I", cfg.idxpage, "directory index `file` name")
flag.StringVar(&cfg.header, "H", cfg.header, "header: prepend contents of `file` to generated pages")
}
tracer.Print("final config:")
- tracer.Print("fqdn: ", cfg.fqdn)
tracer.Print("iface: ", cfg.iface)
tracer.Print("port: ", cfg.port)
+ tracer.Print("fqdn: ", cfg.fqdn)
+ tracer.Print("xport: ", cfg.xport)
tracer.Print("docroot: ", cfg.docroot)
tracer.Print("idxpage: ", cfg.idxpage)
tracer.Print("header: ", cfg.header)
if check(err, "Readdir "+dirname) != nil {
return "", err
}
- loc := "\t" + cfg.fqdn + "\t" + cfg.port + "\r\n"
+ loc := "\t" + cfg.fqdn + "\t" + cfg.xport + "\r\n"
list := ""
if dirname != cfg.docroot {
list += "1..\t" + path.Dir(selector) + loc
if selector == "" {
selector = "/"
}
- page := "iIndex of " + selector + "\tErr\t" + cfg.fqdn + "\t" + cfg.port + "\r\n"
+ page := "iIndex of " + selector + "\tErr\t" + cfg.fqdn + "\t" + cfg.xport + "\r\n"
page += idxpage
var nb1 int
nb1, err = conn.Write([]byte(page))
}
nbytes, _ := sendHeader(conn)
tracer.Print("send error page: ", msg)
- s := "3Gopher Meditation: " + msg + emsg + "\tErr\t" + cfg.fqdn + "\t" + cfg.port + "\r\n"
+ s := "3Gopher Meditation: " + msg + emsg + "\tErr\t" + cfg.fqdn + "\t" + cfg.xport + "\r\n"
nb1, err := conn.Write([]byte(s))
if check(err, "sendError Write ") != nil {
return