MCPcopy
hub / github.com/gliderlabs/ssh / SftpHandler

Function SftpHandler

_examples/ssh-sftpserver/sftp.go:13–32  ·  view source on GitHub ↗

SftpHandler handler for SFTP subsystem

(sess ssh.Session)

Source from the content-addressed store, hash-verified

11
12// SftpHandler handler for SFTP subsystem
13func SftpHandler(sess ssh.Session) {
14 debugStream := io.Discard
15 serverOptions := []sftp.ServerOption{
16 sftp.WithDebug(debugStream),
17 }
18 server, err := sftp.NewServer(
19 sess,
20 serverOptions...,
21 )
22 if err != nil {
23 log.Printf("sftp server init error: %s\n", err)
24 return
25 }
26 if err := server.Serve(); err == io.EOF {
27 server.Close()
28 fmt.Println("sftp client exited session.")
29 } else if err != nil {
30 fmt.Println("sftp server completed with error:", err)
31 }
32}
33
34func main() {
35 ssh_server := ssh.Server{

Callers

nothing calls this directly

Calls 2

ServeMethod · 0.95
CloseMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…