tladesignz / IPtProxy

Obfs4proxy and Snowflake Pluggable Transports for iOS
MIT License
45 stars 11 forks source link

add support for "bridge strings" #34

Closed uniqx closed 1 year ago

uniqx commented 1 year ago

Tor bridges are typically are configured using "bridge strings". I couldn't find the specification for this format but, Tor project also uses it in BridgeDB for passing bridge information to Tor Browser, so it's a quasi-standard at the very least. Here are some examples:

obfs4 87.123.123.123:123 0B6892C2DCD1FE8C1E7CBEA202BCEBECBDE47ECB cert=dZaWyaKA2a26abHSMqPKaE8aPGmeid4FUHGYJMzs9onWMjUuZKotKRYlMIRStVdqKBdOVw iat-mode=0"
snowflake 192.0.2.3:80 2B280A23123456782ABFC40DDCC8824812345678 fingerprint=2B280B23E11012345678C40DDC12345612345678 url=https://snowflake-broker.at.some.domain.com/ front=some.cloud.com ice=stun:stun.server1.com:12345,stun:stun.server2.com:1234,stun:stun.server3.com:9999,stun:stun.server4.com:1234,stun:stun.server5.com:1234,stun:stun.server6.com:12345,stun:stun.server7.com:8765,stun:stun.server8.com:3478,stun:stun.server9.com:3478,stun:stun.server48.com:3478,stun:stun.server3.com:3478,stun:stun.server9000.com:3478 utls-imitate=hellorandomiyedalpn

Using IPtProxy would be considerably more comfortable if it would support this format for starting proxies. Instead of letting all re-implement such a parser, or making them handle bridge configs manually. A dev friendly API could eg. look like this:

IPtProxy.startProxy("obfs4 87.123.123.123:123 0B6892C2DCD1FE8C1E7CBEA202BCEBECBDE47ECB cert=dZaWyaKA2a26abHSMqPKaE8aPGmeid4FUHGYJMzs9onWMjUuZKotKRYlMIRStVdqKBdOVw iat-mode=0")
tladesignz commented 1 year ago

Sorry, this is not how it works.

Please familiarize yourself with Pluggable Transports and specifically, the v1 spec.

Besides that, you don't need to do any parsing of the bridge lines. Hand them over to Tor as-is. Tor will hand it over to the transport, the transport will know what to do.