mirror of https://github.com/ospab/ostp.git
A server with two IPs (one burned by Google, one fresh) needs to control which address traffic leaves from, per destination — direct from the clean IP to a picky site, via the proxy from the other for everything else. - Receive: already selectable via the listen addresses. - Send (global): server config `bind_ip` binds every outbound socket to a chosen source address (threaded through run_server → Router → the direct/proxy/UDP connect paths, which already supported a bind_ip). - Send (per rule): outbound rules gain `send_from` — a source IP that overrides the global bind_ip when that rule matches. select_outbound_action now returns the matched rule's source alongside its action, and both the direct and proxy connect paths (TCP and the SOCKS5 UDP path) bind to rule.send_from, falling back to the global bind_ip. So "direct from 1.2.3.4 to youtube, proxy from 5.6.7.8 otherwise" is expressible. New fields default (send_from: None), so existing configs are unaffected and the migrator backfills them into canonical form. Fixed two pre-existing test call sites that predated the bind_ip parameter. |
||
|---|---|---|
| .. | ||
| transport | ||
| api.rs | ||
| dispatcher.rs | ||
| dns.rs | ||
| fallback.rs | ||
| lib.rs | ||
| outbound.rs | ||
| relay.rs | ||
| relay_node.rs | ||
| router.rs | ||
| signal.rs | ||
| tui.rs | ||