feat: sftp server support (#7643)

* feat: sftp server support

* fix(sftp-server): try fix build failed

* fix: sftp download lack
This commit is contained in:
KirCute_ECT
2024-12-12 20:51:43 +08:00
committed by GitHub
parent 201e25c17f
commit 33ba7f1521
14 changed files with 584 additions and 32 deletions

View File

@ -84,6 +84,11 @@ type FTP struct {
EnablePasvConnIPCheck bool `json:"enable_pasv_conn_ip_check" env:"ENABLE_PASV_CONN_IP_CHECK"`
}
type SFTP struct {
Enable bool `json:"enable" env:"ENABLE"`
Listen string `json:"listen" env:"LISTEN"`
}
type Config struct {
Force bool `json:"force" env:"FORCE"`
SiteURL string `json:"site_url" env:"SITE_URL"`
@ -104,6 +109,7 @@ type Config struct {
Cors Cors `json:"cors" envPrefix:"CORS_"`
S3 S3 `json:"s3" envPrefix:"S3_"`
FTP FTP `json:"ftp" envPrefix:"FTP_"`
SFTP SFTP `json:"sftp" envPrefix:"SFTP_"`
}
func DefaultConfig() *Config {
@ -185,5 +191,9 @@ func DefaultConfig() *Config {
EnableActiveConnIPCheck: true,
EnablePasvConnIPCheck: true,
},
SFTP: SFTP{
Enable: true,
Listen: ":5222",
},
}
}

View File

@ -1,6 +1,7 @@
package conf
import (
"golang.org/x/crypto/ssh"
"net/url"
"regexp"
)
@ -32,3 +33,5 @@ var (
ManageHtml string
IndexHtml string
)
var SSHSigners []ssh.Signer