chore(deps): remove dependency KirCute/ftpserverlib-pasvportmap (#61)

This commit is contained in:
KirCute
2025-06-14 15:56:51 +08:00
committed by GitHub
parent 8a29790327
commit da1cfd1945
8 changed files with 98 additions and 56 deletions

View File

@ -13,7 +13,6 @@ import (
"syscall" "syscall"
"time" "time"
ftpserver "github.com/KirCute/ftpserverlib-pasvportmap"
"github.com/KirCute/sftpd-alist" "github.com/KirCute/sftpd-alist"
"github.com/OpenListTeam/OpenList/cmd/flags" "github.com/OpenListTeam/OpenList/cmd/flags"
"github.com/OpenListTeam/OpenList/internal/bootstrap" "github.com/OpenListTeam/OpenList/internal/bootstrap"
@ -21,6 +20,7 @@ import (
"github.com/OpenListTeam/OpenList/internal/fs" "github.com/OpenListTeam/OpenList/internal/fs"
"github.com/OpenListTeam/OpenList/pkg/utils" "github.com/OpenListTeam/OpenList/pkg/utils"
"github.com/OpenListTeam/OpenList/server" "github.com/OpenListTeam/OpenList/server"
ftpserver "github.com/fclairamb/ftpserverlib"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/spf13/cobra" "github.com/spf13/cobra"

12
go.mod
View File

@ -3,7 +3,6 @@ module github.com/OpenListTeam/OpenList
go 1.23.4 go 1.23.4
require ( require (
github.com/KirCute/ftpserverlib-pasvportmap v1.25.0
github.com/KirCute/sftpd-alist v0.0.12 github.com/KirCute/sftpd-alist v0.0.12
github.com/ProtonMail/go-crypto v1.0.0 github.com/ProtonMail/go-crypto v1.0.0
github.com/SheltonZhu/115driver v1.0.34 github.com/SheltonZhu/115driver v1.0.34
@ -54,7 +53,7 @@ require (
github.com/rclone/rclone v1.67.0 github.com/rclone/rclone v1.67.0
github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d github.com/saintfish/chardet v0.0.0-20230101081208-5e3ef4b5456d
github.com/sirupsen/logrus v1.9.3 github.com/sirupsen/logrus v1.9.3
github.com/spf13/afero v1.11.0 github.com/spf13/afero v1.14.0
github.com/spf13/cobra v1.8.1 github.com/spf13/cobra v1.8.1
github.com/stretchr/testify v1.10.0 github.com/stretchr/testify v1.10.0
github.com/t3rm1n4l/go-mega v0.0.0-20240219080617-d494b6a8ace7 github.com/t3rm1n4l/go-mega v0.0.0-20240219080617-d494b6a8ace7
@ -83,6 +82,7 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.0 // indirect
github.com/fclairamb/ftpserverlib v0.26.1-0.20250611192536-99cb646d0bbe // indirect
) )
require ( require (
@ -101,7 +101,7 @@ require (
github.com/cloudwego/iasm v0.2.0 // indirect github.com/cloudwego/iasm v0.2.0 // indirect
github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect github.com/dsnet/compress v0.0.2-0.20230904184137-39efe44ab707 // indirect
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
github.com/fclairamb/go-log v0.5.0 // indirect github.com/fclairamb/go-log v0.6.0 // indirect
github.com/gorilla/css v1.0.1 // indirect github.com/gorilla/css v1.0.1 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
@ -198,7 +198,7 @@ require (
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed // indirect github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed // indirect
github.com/mailru/easyjson v0.7.7 // indirect github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-localereader v0.0.1 // indirect github.com/mattn/go-localereader v0.0.1 // indirect
github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect
@ -253,8 +253,8 @@ require (
go.etcd.io/bbolt v1.3.8 // indirect go.etcd.io/bbolt v1.3.8 // indirect
golang.org/x/arch v0.8.0 // indirect golang.org/x/arch v0.8.0 // indirect
golang.org/x/sync v0.12.0 golang.org/x/sync v0.12.0
golang.org/x/sys v0.31.0 // indirect golang.org/x/sys v0.33.0 // indirect
golang.org/x/term v0.30.0 // indirect golang.org/x/term v0.32.0 // indirect
golang.org/x/text v0.23.0 golang.org/x/text v0.23.0
golang.org/x/tools v0.24.0 // indirect golang.org/x/tools v0.24.0 // indirect
google.golang.org/api v0.169.0 // indirect google.golang.org/api v0.169.0 // indirect

16
go.sum
View File

@ -28,8 +28,6 @@ github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.6.0/go.mod h1:cTvi54pg19
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/KirCute/ftpserverlib-pasvportmap v1.25.0 h1:ikwCzeqoqN6wvBHOB9OI6dde/jbV7EoTMpUcxtYl5Po=
github.com/KirCute/ftpserverlib-pasvportmap v1.25.0/go.mod h1:v0NgMtKDDi/6CM6r4P+daCljCW3eO9yS+Z+pZDTKo1E=
github.com/KirCute/sftpd-alist v0.0.12 h1:GNVM5QLbQLAfXP4wGUlXFA2IO6fVek0n0IsGnOuISdg= github.com/KirCute/sftpd-alist v0.0.12 h1:GNVM5QLbQLAfXP4wGUlXFA2IO6fVek0n0IsGnOuISdg=
github.com/KirCute/sftpd-alist v0.0.12/go.mod h1:2wNK7yyW2XfjyJq10OY6xB4COLac64hOwfV6clDJn6s= github.com/KirCute/sftpd-alist v0.0.12/go.mod h1:2wNK7yyW2XfjyJq10OY6xB4COLac64hOwfV6clDJn6s=
github.com/Max-Sum/base32768 v0.0.0-20230304063302-18e6ce5945fd h1:nzE1YQBdx1bq9IlZinHa+HVffy+NmVRoKr+wHN8fpLE= github.com/Max-Sum/base32768 v0.0.0-20230304063302-18e6ce5945fd h1:nzE1YQBdx1bq9IlZinHa+HVffy+NmVRoKr+wHN8fpLE=
@ -198,8 +196,13 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4= github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM= github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
github.com/fclairamb/ftpserverlib v0.26.0/go.mod h1:XMm3NdvCvmBtoAVK86oERDVmoYo0GTNS5gdds4f9lpM=
github.com/fclairamb/ftpserverlib v0.26.1-0.20250611192536-99cb646d0bbe h1:7hWzlndXJKF95RsWQ80bZmdPiBhoTIzedrp/VDGons8=
github.com/fclairamb/ftpserverlib v0.26.1-0.20250611192536-99cb646d0bbe/go.mod h1:xaDvN9bHSdKbmM1oXkqpyyYM39S89uR2blbq571Zb00=
github.com/fclairamb/go-log v0.5.0 h1:Gz9wSamEaA6lta4IU2cjJc2xSq5sV5VYSB5w/SUHhVc= github.com/fclairamb/go-log v0.5.0 h1:Gz9wSamEaA6lta4IU2cjJc2xSq5sV5VYSB5w/SUHhVc=
github.com/fclairamb/go-log v0.5.0/go.mod h1:XoRO1dYezpsGmLLkZE9I+sHqpqY65p8JA+Vqblb7k40= github.com/fclairamb/go-log v0.5.0/go.mod h1:XoRO1dYezpsGmLLkZE9I+sHqpqY65p8JA+Vqblb7k40=
github.com/fclairamb/go-log v0.6.0 h1:1V7BJ75P2PvanLHRyGBBFjncB6d4AgEmu+BPWKbMkaU=
github.com/fclairamb/go-log v0.6.0/go.mod h1:cyXxOw4aJwO6lrZb8GRELSw+sxO6wwkLJdsjY5xYCWA=
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/foxxorcat/mopan-sdk-go v0.1.6 h1:6J37oI4wMZLj8EPgSCcSTTIbnI5D6RCNW/srX8vQd1Y= github.com/foxxorcat/mopan-sdk-go v0.1.6 h1:6J37oI4wMZLj8EPgSCcSTTIbnI5D6RCNW/srX8vQd1Y=
@ -227,6 +230,7 @@ github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ=
github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
@ -421,6 +425,8 @@ github.com/matoous/go-nanoid/v2 v2.1.0 h1:P64+dmq21hhWdtvZfEAofnvJULaRR1Yib0+PnU
github.com/matoous/go-nanoid/v2 v2.1.0/go.mod h1:KlbGNQ+FhrUNIHUxZdL63t7tl4LaPkZNpUULS8H4uVM= github.com/matoous/go-nanoid/v2 v2.1.0/go.mod h1:KlbGNQ+FhrUNIHUxZdL63t7tl4LaPkZNpUULS8H4uVM=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
@ -557,6 +563,8 @@ github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2
github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk=
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY=
github.com/spf13/afero v1.14.0 h1:9tH6MapGnn/j0eb0yIXiLjERO8RB6xIVZRDCX7PtqWA=
github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZmbYo=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
@ -805,6 +813,8 @@ golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@ -819,6 +829,8 @@ golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

View File

@ -13,13 +13,13 @@ import (
"strings" "strings"
"sync" "sync"
ftpserver "github.com/KirCute/ftpserverlib-pasvportmap"
"github.com/OpenListTeam/OpenList/internal/conf" "github.com/OpenListTeam/OpenList/internal/conf"
"github.com/OpenListTeam/OpenList/internal/model" "github.com/OpenListTeam/OpenList/internal/model"
"github.com/OpenListTeam/OpenList/internal/op" "github.com/OpenListTeam/OpenList/internal/op"
"github.com/OpenListTeam/OpenList/internal/setting" "github.com/OpenListTeam/OpenList/internal/setting"
"github.com/OpenListTeam/OpenList/pkg/utils" "github.com/OpenListTeam/OpenList/pkg/utils"
"github.com/OpenListTeam/OpenList/server/ftp" "github.com/OpenListTeam/OpenList/server/ftp"
ftpserver "github.com/fclairamb/ftpserverlib"
) )
type FtpMainDriver struct { type FtpMainDriver struct {
@ -58,31 +58,27 @@ func NewMainDriver() (*FtpMainDriver, error) {
} }
return &FtpMainDriver{ return &FtpMainDriver{
settings: &ftpserver.Settings{ settings: &ftpserver.Settings{
ListenAddr: conf.Conf.FTP.Listen, ListenAddr: conf.Conf.FTP.Listen,
PublicHost: lookupIP(setting.GetStr(conf.FTPPublicHost)), PublicHost: lookupIP(setting.GetStr(conf.FTPPublicHost)),
PassiveTransferPortGetter: newPortMapper(setting.GetStr(conf.FTPPasvPortMap)), PassiveTransferPortRange: newPortMapper(setting.GetStr(conf.FTPPasvPortMap)),
FindPasvPortAttempts: conf.Conf.FTP.FindPasvPortAttempts, ActiveTransferPortNon20: conf.Conf.FTP.ActiveTransferPortNon20,
ActiveTransferPortNon20: conf.Conf.FTP.ActiveTransferPortNon20, IdleTimeout: conf.Conf.FTP.IdleTimeout,
IdleTimeout: conf.Conf.FTP.IdleTimeout, ConnectionTimeout: conf.Conf.FTP.ConnectionTimeout,
ConnectionTimeout: conf.Conf.FTP.ConnectionTimeout, DisableMLSD: false,
DisableMLSD: false, DisableMLST: false,
DisableMLST: false, DisableMFMT: true,
DisableMFMT: true, Banner: setting.GetStr(conf.Announcement),
Banner: setting.GetStr(conf.Announcement), TLSRequired: tlsRequired,
TLSRequired: tlsRequired, DisableLISTArgs: false,
DisableLISTArgs: false, DisableSite: false,
DisableSite: false, DisableActiveMode: conf.Conf.FTP.DisableActiveMode,
DisableActiveMode: conf.Conf.FTP.DisableActiveMode, EnableHASH: false,
EnableHASH: false, DisableSTAT: false,
DisableSTAT: false, DisableSYST: false,
DisableSYST: false, EnableCOMB: false,
EnableCOMB: false, DefaultTransferType: transferType,
DefaultTransferType: transferType, ActiveConnectionsCheck: activeConnCheck,
ActiveConnectionsCheck: activeConnCheck, PasvConnectionsCheck: pasvConnCheck,
PasvConnectionsCheck: pasvConnCheck,
SiteHandlers: map[string]ftpserver.SiteHandler{
"SIZE": ftp.HandleSIZE,
},
}, },
proxyHeader: header, proxyHeader: header,
clients: make(map[uint32]ftpserver.ClientContext), clients: make(map[uint32]ftpserver.ClientContext),
@ -182,16 +178,39 @@ func lookupIP(host string) string {
return v6 return v6
} }
type group struct {
ExposedStart int
ListenedStart int
Length int
}
type pasvPortGetter struct {
groups []group
totalLength int
}
func (m *pasvPortGetter) FetchNext() (int, int, bool) {
idxPort := rand.Intn(m.totalLength)
for _, g := range m.groups {
if idxPort >= g.Length {
idxPort -= g.Length
} else {
return g.ExposedStart + idxPort, g.ListenedStart + idxPort, true
}
}
// unreachable
return 0, 0, false
}
func (m *pasvPortGetter) NumberAttempts() int {
return conf.Conf.FTP.FindPasvPortAttempts
}
func newPortMapper(str string) ftpserver.PasvPortGetter { func newPortMapper(str string) ftpserver.PasvPortGetter {
if str == "" { if str == "" {
return nil return nil
} }
pasvPortMappers := strings.Split(strings.Replace(str, "\n", ",", -1), ",") pasvPortMappers := strings.Split(strings.Replace(str, "\n", ",", -1), ",")
type group struct {
ExposedStart int
ListenedStart int
Length int
}
groups := make([]group, len(pasvPortMappers)) groups := make([]group, len(pasvPortMappers))
totalLength := 0 totalLength := 0
convertToPorts := func(str string) (int, int, error) { convertToPorts := func(str string) (int, int, error) {
@ -255,18 +274,7 @@ func newPortMapper(str string) ftpserver.PasvPortGetter {
return nil return nil
} }
} }
return func() (int, int, bool) { return &pasvPortGetter{groups: groups, totalLength: totalLength}
idxPort := rand.Intn(totalLength)
for _, g := range groups {
if idxPort >= g.Length {
idxPort -= g.Length
} else {
return g.ExposedStart + idxPort, g.ListenedStart + idxPort, true
}
}
// unreachable
return 0, 0, false
}
} }
func getTlsConf(keyPath, certPath string) (*tls.Config, error) { func getTlsConf(keyPath, certPath string) (*tls.Config, error) {

View File

@ -4,12 +4,13 @@ import (
"context" "context"
"errors" "errors"
"os" "os"
"strings"
"time" "time"
ftpserver "github.com/KirCute/ftpserverlib-pasvportmap"
"github.com/OpenListTeam/OpenList/internal/errs" "github.com/OpenListTeam/OpenList/internal/errs"
"github.com/OpenListTeam/OpenList/internal/fs" "github.com/OpenListTeam/OpenList/internal/fs"
"github.com/OpenListTeam/OpenList/internal/model" "github.com/OpenListTeam/OpenList/internal/model"
ftpserver "github.com/fclairamb/ftpserverlib"
"github.com/spf13/afero" "github.com/spf13/afero"
) )
@ -117,6 +118,26 @@ func (a *AferoAdapter) GetHandle(name string, flags int, offset int64) (ftpserve
return OpenDownload(a.ctx, path, offset) return OpenDownload(a.ctx, path, offset)
} }
func (a *AferoAdapter) Site(param string) *ftpserver.AnswerCommand {
spl := strings.SplitN(param, " ", 2)
cmd := strings.ToUpper(spl[0])
var params string
if len(spl) > 1 {
params = spl[1]
} else {
params = ""
}
switch cmd {
case "SIZE":
code, msg := HandleSIZE(params, a)
return &ftpserver.AnswerCommand{
Code: code,
Message: msg,
}
}
return nil
}
func (a *AferoAdapter) SetNextFileSize(size int64) { func (a *AferoAdapter) SetNextFileSize(size int64) {
a.nextFileSize = size a.nextFileSize = size
} }

View File

@ -7,13 +7,13 @@ import (
"os" "os"
"time" "time"
ftpserver "github.com/KirCute/ftpserverlib-pasvportmap"
"github.com/OpenListTeam/OpenList/internal/errs" "github.com/OpenListTeam/OpenList/internal/errs"
"github.com/OpenListTeam/OpenList/internal/fs" "github.com/OpenListTeam/OpenList/internal/fs"
"github.com/OpenListTeam/OpenList/internal/model" "github.com/OpenListTeam/OpenList/internal/model"
"github.com/OpenListTeam/OpenList/internal/op" "github.com/OpenListTeam/OpenList/internal/op"
"github.com/OpenListTeam/OpenList/internal/stream" "github.com/OpenListTeam/OpenList/internal/stream"
"github.com/OpenListTeam/OpenList/server/common" "github.com/OpenListTeam/OpenList/server/common"
ftpserver "github.com/fclairamb/ftpserverlib"
"github.com/pkg/errors" "github.com/pkg/errors"
) )

View File

@ -9,7 +9,6 @@ import (
stdpath "path" stdpath "path"
"time" "time"
ftpserver "github.com/KirCute/ftpserverlib-pasvportmap"
"github.com/OpenListTeam/OpenList/internal/conf" "github.com/OpenListTeam/OpenList/internal/conf"
"github.com/OpenListTeam/OpenList/internal/errs" "github.com/OpenListTeam/OpenList/internal/errs"
"github.com/OpenListTeam/OpenList/internal/fs" "github.com/OpenListTeam/OpenList/internal/fs"
@ -17,6 +16,7 @@ import (
"github.com/OpenListTeam/OpenList/internal/op" "github.com/OpenListTeam/OpenList/internal/op"
"github.com/OpenListTeam/OpenList/internal/stream" "github.com/OpenListTeam/OpenList/internal/stream"
"github.com/OpenListTeam/OpenList/server/common" "github.com/OpenListTeam/OpenList/server/common"
ftpserver "github.com/fclairamb/ftpserverlib"
"github.com/pkg/errors" "github.com/pkg/errors"
) )

View File

@ -2,8 +2,9 @@ package ftp
import ( import (
"fmt" "fmt"
ftpserver "github.com/KirCute/ftpserverlib-pasvportmap"
"strconv" "strconv"
ftpserver "github.com/fclairamb/ftpserverlib"
) )
func HandleSIZE(param string, client ftpserver.ClientDriver) (int, string) { func HandleSIZE(param string, client ftpserver.ClientDriver) (int, string) {