func NewHandler(sc *ssh.ServerConn, srv *server.Server) *Handler {
	return &Handler{
		permissions: strings.Split(sc.Permissions.Extensions["permissions"], ","),
		server:      srv,
		fs:          srv.Filesystem(),
		ro:          config.Get().System.Sftp.ReadOnly,
		logger: log.WithFields(log.Fields{
			"subsystem": "sftp",
			"username":  sc.User(),
			"ip":        sc.RemoteAddr(),
		}),
	}
}
Returns a new connection handler for the SFTP server. This allows a given user
to access the underlying filesystem.
package sftp
import (
	"io"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"
	"sync"
	"emperror.dev/errors"
	"github.com/apex/log"
	"github.com/pkg/sftp"
	"golang.org/x/crypto/ssh"
	"github.com/pterodactyl/wings/config"
	"github.com/pterodactyl/wings/server"
	"github.com/pterodactyl/wings/server/filesystem"
)
const (
	PermissionFileRead        = "file.read"
	PermissionFileReadContent = "file.read-content"
	PermissionFileCreate      = "file.create"
	PermissionFileUpdate      = "file.update"
	PermissionFileDelete      = "file.delete"
)
type Handler struct {
	mu sync.Mutex
	permissions []string
	server      *server.Server
	fs          *filesystem.Filesystem
	logger      *log.Entry
	ro          bool
}