@@ -48,6 +48,7 @@ const (
4848 SOCKS5 = x .SOCKS5
4949 HTTP1 = x .HTTP1
5050 WG = x .WG
51+ WGFAST = x .WGFAST
5152 PIPH2 = x .PIPH2
5253 PIPWS = x .PIPWS
5354 NOOP = x .NOOP
@@ -702,7 +703,14 @@ func (px *proxifier) clearpins() (int, int) {
702703// ProxyFor implements Proxies.
703704func (px * proxifier ) ProxyFor (id string ) (Proxy , error ) {
704705 p , err := px .proxyFor (id )
705- if ! errors .Is (err , errProxyNotFound ) {
706+ if ! errors .Is (err , errProxyNotFound ) || ! isWellknown (id ) {
707+ // return proxy not found for non-wellknown proxy ids immediately without waiting
708+ // because the constructor's of dns transports call into ProxyFor with their own IDs
709+ // (ex: dnsx.Default / dnsx.Preferred) to auto-setup the transporting over proxy
710+ // (ex: when WireGuard DNS53 transports are setup). Waiting for "maxWaitPeriodSec"
711+ // then delays construction of the transport & in case of dnsx.Default specifically,
712+ // it results in prolonged intra.NewTunnel creation, which is sensitive to delays,
713+ // as it is expected to be called from the main service thread of the Android client.
706714 return p , err
707715 }
708716
@@ -1459,10 +1467,6 @@ func (px *proxifier) testExit64() (ips string, errs error) {
14591467 return strings .Join (oks , "," ), nil
14601468}
14611469
1462- func isWG (id string ) bool {
1463- return strings .Contains (id , WG )
1464- }
1465-
14661470func IsAnyLocalProxy (ids ... string ) bool {
14671471 return core .IsAny (ids , local )
14681472}
@@ -1499,8 +1503,28 @@ func isInternal(id string) bool {
14991503 return isRPN (id ) || immutable (id )
15001504}
15011505
1506+ func isWellknown (id string ) bool {
1507+ return isInternal (id ) || isWG (id ) || isOrbot (id ) || isGlobalH1 (id ) || isPip (id )
1508+ }
1509+
15021510func isRPN (id string ) bool {
1503- return strings .Contains (id , RPN )
1511+ return strings .Contains (id , RPN ) // RPN is a suffix
1512+ }
1513+
1514+ func isWG (id string ) bool {
1515+ return strings .HasPrefix (id , WG ) || strings .HasPrefix (id , WGFAST )
1516+ }
1517+
1518+ func isOrbot (id string ) bool {
1519+ return id == OrbotH1 || id == OrbotS5
1520+ }
1521+
1522+ func isGlobalH1 (id string ) bool {
1523+ return id == GlobalH1
1524+ }
1525+
1526+ func isPip (id string ) bool {
1527+ return strings .HasPrefix (id , PIPH2 ) || strings .HasPrefix (id , PIPWS )
15041528}
15051529
15061530func idling (t time.Time ) bool {
0 commit comments