Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

主动模式下自定义端口问题 #66

Open
dragon-dan opened this issue Nov 21, 2024 · 0 comments
Open

主动模式下自定义端口问题 #66

dragon-dan opened this issue Nov 21, 2024 · 0 comments

Comments

@dragon-dan
Copy link

当使用主动模式时ActiveTransfers设置为true,然后想指定使用的端口,反复尝试配置ActiveListenAddr参数,发现只能配置为 ip:0 这种格式使用动态端口,指定一个端口时会报错

ActiveListenAddr配置为 172.16.50.190:24001 报错如下
goftp: 6.383 #1 was ready
goftp: 6.383 #1 listening on 172.16.50.190:24001 for active connection
goftp: 6.383 #1 sending command PORT 172,16,50,190,93,193
goftp: 6.384 #1 got 200-Connection established (24001)
goftp: 6.385 #1 sending command MLSD .
goftp: 6.385 #1 got 500-Command not found
goftp: 6.385 #1 was ready
panic: error listening on 172.16.50.190:24001 for active transfer: listen tcp 172.16.50.190:24001: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted.

ActiveListenAddr配置为 172.16.50.190:0 工作正常
goftp: 2.667 #1 listening on 172.16.50.190:52771 for active connection
goftp: 2.667 #1 sending command PORT 172,16,50,190,206,35
goftp: 2.667 #1 got 200-Connection established (52771)
goftp: 2.668 #1 sending command MLSD .
goftp: 2.668 #1 got 500-Command not found
goftp: 2.668 #1 was ready
goftp: 2.668 #1 listening on 172.16.50.190:52773 for active connection
goftp: 2.668 #1 sending command PORT 172,16,50,190,206,37
goftp: 2.668 #1 got 200-Connection established (52773)
goftp: 2.669 #1 sending command LIST .
goftp: 2.671 #1 got 150-Opening ASCII mode data connection for file list

看起来是内部逻辑多次监听同一个地址导致的,既然是要使用多个端口,ActiveListenAddr是否应该配置一个端口范围呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant