本文整理汇总了Golang中code/google/com/p/go9p/p/srv.Fsrv类的典型用法代码示例。如果您正苦于以下问题:Golang Fsrv类的具体用法?Golang Fsrv怎么用?Golang Fsrv使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Fsrv类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
var err error
var tm *Time
var ntm *InfTime
var s *srv.Fsrv
var p9c net.Conn
var ch chan bool
var usr *user.User
flag.Parse()
root := new(srv.File)
usr, err = user.Current()
if err != nil {
goto error
}
// log.Println("running as User: ", usr)
err = root.Add(nil, "/", UserNone(usr.Uid), nil, p.DMDIR|0555, nil)
if err != nil {
goto error
}
tm = new(Time)
err = tm.Add(root, "time", UserNone(usr.Uid), nil, 0444, tm)
if err != nil {
goto error
}
ntm = new(InfTime)
err = ntm.Add(root, "inftime", UserNone(usr.Uid), nil, 0444, ntm)
if err != nil {
goto error
}
s = srv.NewFileSrv(root)
s.Dotu = false
s.Upool = NoneUsers{}
if *debug {
s.Debuglevel = 1
}
if *debugall {
s.Debuglevel = 2
}
log.Println("starting tree")
s.Start(s)
p9c, err = NewSrvConn(*addr)
if err != nil {
goto error
}
log.Println("starting")
s.NewConn(p9c)
<-ch
return
error:
log.Println(fmt.Sprintf("Error: %s", err))
}
示例2: serveStats
func serveStats() {
var addrslice []string
var err error
var saddr string
var sf *StatsFile
var s *srv.Fsrv
root, err := mkroot()
if err != nil {
goto error
}
sf = new(StatsFile)
err = sf.Add(root, "stats", p.OsUsers.Uid2User(os.Geteuid()), nil, 0444, sf)
if err != nil {
goto error
}
s = srv.NewFileSrv(root)
s.Dotu = true
addrslice = strings.Split(*laddr, ":")
saddr = fmt.Sprintf("%s:%d", addrslice[0], *sport)
s.Start(s)
err = s.StartNetListener("tcp", saddr)
if err != nil {
goto error
}
error:
log.Printf("Error: %s\n", err)
}
示例3: main
func main() {
var err error
var s *srv.Fsrv
flag.Parse()
useragent = *aflag
timeout = *tflag
root = new(srv.File)
err = root.Add(nil, "/", user, user, p.DMDIR|0666, root)
if err != nil {
goto error
}
cl = new(Clone)
if err = cl.Add(root, "clone", user, user, 0666, cl); err != nil {
goto error
}
ctl = new(RootCtl)
if err = ctl.Add(root, "ctl", user, user, 0666, ctl); err != nil {
goto error
}
s = srv.NewFileSrv(root)
s.Debuglevel = *debug
s.Start(s)
s.Id = "webfs"
err = s.StartNetListener("tcp", *addr)
if err != nil {
goto error
}
/*
webfs := new(Webfs)
webfs.useragent = "hjdicks"
webfs.timeout = 10000
webfs.Id = "webfs"
webfs.Debuglevel = 1
webfs.Start(webfs)
err := webfs.StartNetListener("tcp", ":5640")
if err != nil {
goto error
}*/
return
error:
log.Println(fmt.Sprintf("Error: %s", err))
}
示例4: main
func main() {
var err error
var tm *Time
var ntm *InfTime
var s *srv.Fsrv
flag.Parse()
user := p.OsUsers.Uid2User(os.Geteuid())
root := new(srv.File)
err = root.Add(nil, "/", user, nil, p.DMDIR|0555, nil)
if err != nil {
goto error
}
tm = new(Time)
err = tm.Add(root, "time", p.OsUsers.Uid2User(os.Geteuid()), nil, 0444, tm)
if err != nil {
goto error
}
ntm = new(InfTime)
err = ntm.Add(root, "inftime", p.OsUsers.Uid2User(os.Geteuid()), nil, 0444, ntm)
if err != nil {
goto error
}
s = srv.NewFileSrv(root)
s.Dotu = true
if *debug {
s.Debuglevel = 1
}
if *debugall {
s.Debuglevel = 2
}
s.Start(s)
err = s.StartNetListener("tcp", *addr)
if err != nil {
goto error
}
return
error:
log.Println(fmt.Sprintf("Error: %s", err))
}
示例5: main
func main() {
var err error
var cl *Clone
var s *srv.Fsrv
flag.Parse()
user := p.OsUsers.Uid2User(os.Geteuid())
root = new(srv.File)
err = root.Add(nil, "/", user, nil, p.DMDIR|0777, nil)
if err != nil {
goto error
}
cl = new(Clone)
err = cl.Add(root, "clone", p.OsUsers.Uid2User(os.Geteuid()), nil, 0444, cl)
if err != nil {
goto error
}
s = srv.NewFileSrv(root)
s.Dotu = true
if *debug {
s.Debuglevel = 1
}
s.Start(s)
err = s.StartNetListener("tcp", *addr)
if err != nil {
goto error
}
return
error:
log.Println(fmt.Sprintf("Error: %s", err))
}
示例6: serve9p
func serve9p() {
var cl *Clone
var err error
var s *srv.Fsrv
var sf *StatsFile
root, err = mkroot()
if err != nil {
goto error
}
cl = new(Clone)
err = cl.Add(root, "clone", p.OsUsers.Uid2User(os.Geteuid()), nil, 0444, cl)
if err != nil {
goto error
}
sf = new(StatsFile)
err = sf.Add(root, "stats", p.OsUsers.Uid2User(os.Geteuid()), nil, 0444, sf)
if err != nil {
goto error
}
s = srv.NewFileSrv(root)
s.Dotu = true
s.Start(s)
err = s.StartNetListener("tcp", *laddr)
if err != nil {
goto error
}
return
error:
log.Fatalf("Error serving 9p: %s\n", err)
}