浏览文件
harness_export.go
23 行 · 601 B历史下载| 1 | package reversesshfs |
| 2 | |
| 3 | import "io" |
| 4 | |
| 5 | // HarnessServer exposes newRootedServer to the harness. tests/sftp/run copies |
| 6 | // it into a copy of third_party/sshocker, never into third_party itself. |
| 7 | func HarnessServer(rwc io.ReadWriteCloser, localPath string, names []string) (interface{ Serve() error }, error) { |
| 8 | srv, h, err := newRootedServer(rwc, localPath, false, names) |
| 9 | if err != nil { |
| 10 | return nil, err |
| 11 | } |
| 12 | return serveCloser{srv, h}, nil |
| 13 | } |
| 14 | |
| 15 | type serveCloser struct { |
| 16 | srv interface{ Serve() error } |
| 17 | h *rootedHandlers |
| 18 | } |
| 19 | |
| 20 | func (s serveCloser) Serve() error { |
| 21 | defer s.h.Close() |
| 22 | return s.srv.Serve() |
| 23 | } |

