Exemplo n.º 1
0
func init() {
	aflist_re = regexp.MustCompile(aflist_pat)

	Dir = nopfs.NewDir()

	var err error
	aflist_prog, err = exec.LookPath("aflist")
	if err == nil {
		AfList = nopfs.NewDir()
		Dir.Append("aflist", AfList)

		go func() {
			ticker := time.NewTicker(5 * time.Minute)
			aflist(ticker)
		}()
	}
}
Exemplo n.º 2
0
func init() {
	var err error
	ping_prog, err = exec.LookPath("fping")
	if err != nil {
		ping_prog, err = exec.LookPath("ping")
		fping = false
	}
	if err == nil {
		Ping = nopfs.NewCmd(nopfs.HostC(ping))
	}

	ping6_prog, err = exec.LookPath("fping6")
	if err != nil {
		ping6_prog, err = exec.LookPath("ping6")
		fping6 = false
	}
	if err == nil {
		Ping6 = nopfs.NewCmd(nopfs.HostC(ping6))
	}

	trace_prog, err = exec.LookPath("traceroute")
	if err == nil {
		Trace = nopfs.NewCmd(nopfs.HostC(trace))
	}

	trace6_prog, err = exec.LookPath("traceroute6")
	if err == nil {
		Trace6 = nopfs.NewCmd(nopfs.HostC(trace6))
	}

	mtr_prog, err = exec.LookPath("mtr")
	if err == nil {
		Mtr = nopfs.NewCmd(nopfs.HostC(mtr))
		MtrT = nopfs.NewCmd(nopfs.HostC(mtrt))
	}

	Dir = nopfs.NewDir()
	Dir.Append("README.txt", Readme)

	if Ping != nil {
		Dir.Append("ping", Ping)
	}
	if Ping6 != nil {
		Dir.Append("ping6", Ping6)
	}
	if Trace != nil {
		Dir.Append("trace", Trace)
	}
	if Trace6 != nil {
		Dir.Append("trace6", Trace6)
	}
	if Mtr != nil {
		Dir.Append("mtr", Mtr)
		Dir.Append("mtrt", MtrT)
	}
}
Exemplo n.º 3
0
Arquivo: dns.go Projeto: wwaites/nopfs
func init() {
	Dir = nopfs.NewDir()
	Dir.Append("README.txt", Readme)
	Dir.Append("addr", Addr)
	Dir.Append("cname", CName)
	Dir.Append("name", Name)
	Dir.Append("mx", MX)
	Dir.Append("ns", NS)
	Dir.Append("txt", TXT)

}
Exemplo n.º 4
0
func main() {
	flag.Parse()

	root := nopfs.NewDir()
	root.Append("README.txt", nopfs.NewFile([]byte(readme_top)))

	host := nopfs.NewAnyDir()
	root.Append("host", host)
	host.Static("README.txt", nopfs.NewFile([]byte(readme_host)))
	host.Static("clear", &nopfs.Ctl{Writer: nopfs.AnyDirCtlReset})

	host.Append("icmp", icmp.Dir)
	host.Append("dns", dns.Dir)

	sfs := new(nopfs.NopSrv)
	sfs.Debuglevel = *debug
	sfs.Root = root
	sfs.Start(sfs)
	err := sfs.StartNetListener("tcp", *addr)
	if err != nil {
		log.Fatalf("%s", err)
	}
}