feat: Add flag to force use of local control host address #259
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The assumption in the
enterPassiveModeIPv4
function (insrc/transfer.ts:48
) is that NAT is only used if the "control connection" uses a public IP address and the "data connection" uses a private IP address.However, in our particular scenario this is not the case. Both the control connection and the data connection use an private IP address but we are using NAT. The correct behaviour in this case would be to ignore the IP address mentioned in the PASV-response and instead use the control IP address.
To ensure we don't change current behaviour, we would like to introduce a configuration option that always uses the IP address of the control connection, regardless of whether the IP address is public or private. This configuration flag, called
alwaysUseControlHost
, is passed in the contructor and defaults to false.