Port forwarding - #1601
Closed
TonySD wants to merge 5 commits into
Closed
Conversation
Emit a sing-box direct inbound per port-forward rule, listening locally and overriding the destination to a remote host:port. With no specific route rule they ride route.final, so they tunnel through whichever profile is active. Rules persist as a JSON string setting.
Table editor (name, listen addr/port, remote host/port, protocol) behind an Edit button next to Custom Inbound. Validates port ranges, required remote host, and duplicate listen endpoints on save.
Add an Enabled checkbox column so a forward can be turned off without deleting it. Disabled rules are kept in settings but skipped when the config is generated. Rules without the field default to enabled.
Forward inbounds inherited the global sniff and hijack-dns route rules, so a forward to a DNS server was captured by the internal resolver and TLS/HTTP forwards could be re-routed by domain rules. Give the forward inbounds a terminal route rule to the active proxy, placed first, so they bypass sniff/dns-hijack and always egress through final.
The save handler validated and reserved a listen port for every row regardless of the Enabled checkbox, so a disabled rule could not be parked (incomplete drafts were rejected) and blocked an enabled rule on the same port. Validate and reserve ports only for enabled rows, mirroring the generator. Also seed the used-port set with the app's own SOCKS and DNS inbounds so a forward cannot collide with them and abort the tunnel. Reuse IsValidPort for the range checks.
Member
|
Hello! Thanks for putting time into this. p.n: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hello!
Sometimes I need to connect to remote wireguard service, and it the most stable way - to tunnel host UDP-port via xray.
So I tried to add port forwarding to the application.