@@ -113,6 +113,7 @@ func cmdRun(args []string) error {
113113 dataDir := fs .String ("data" , cfg .DataDir , "data directory" )
114114 verbose := fs .Bool ("v" , false , "verbose (debug) logging" )
115115 insecure := fs .Bool ("insecure" , false , "skip upstream certificate verification (debugging only)" )
116+ upstreamProxyURL := fs .String ("upstream-proxy" , os .Getenv ("DOPPEL_UPSTREAM_PROXY" ), "upstream SOCKS5 proxy URL" )
116117 if err := fs .Parse (args ); err != nil {
117118 return err
118119 }
@@ -132,9 +133,13 @@ func cmdRun(args []string) error {
132133 if err != nil {
133134 return err
134135 }
136+ upstreamProxy , err := upstream .ParseProxy (* upstreamProxyURL )
137+ if err != nil {
138+ return err
139+ }
135140
136141 transport := & upstream.RoundTripper {
137- Dialer : & upstream.Dialer {SkipVerify : * insecure },
142+ Dialer : & upstream.Dialer {SkipVerify : * insecure , UpstreamProxy : upstreamProxy },
138143 Profile : selected ,
139144 }
140145 defer transport .Close ()
@@ -170,6 +175,7 @@ func cmdLaunch(args []string) error {
170175 dataDir := fs .String ("data" , cfg .DataDir , "data directory" )
171176 verbose := fs .Bool ("v" , false , "verbose (debug) logging" )
172177 insecure := fs .Bool ("insecure" , false , "skip upstream certificate verification (debugging only)" )
178+ upstreamProxyURL := fs .String ("upstream-proxy" , os .Getenv ("DOPPEL_UPSTREAM_PROXY" ), "upstream SOCKS5 proxy URL" )
173179 includeEnv := fs .Bool ("env" , true , "set HTTPS proxy and CA environment variables for the child" )
174180 electron := fs .Bool ("electron" , false , "append Chromium/Electron proxy command-line switches" )
175181 allSchemes := fs .Bool ("all-schemes" , false , "with -electron, proxy every Chromium URL scheme instead of HTTPS only" )
@@ -197,9 +203,13 @@ func cmdLaunch(args []string) error {
197203 if err != nil {
198204 return err
199205 }
206+ upstreamProxy , err := upstream .ParseProxy (* upstreamProxyURL )
207+ if err != nil {
208+ return err
209+ }
200210
201211 transport := & upstream.RoundTripper {
202- Dialer : & upstream.Dialer {SkipVerify : * insecure },
212+ Dialer : & upstream.Dialer {SkipVerify : * insecure , UpstreamProxy : upstreamProxy },
203213 Profile : selected ,
204214 }
205215 defer transport .Close ()
@@ -330,6 +340,7 @@ func cmdVerify(args []string) error {
330340 profileName := fs .String ("profile" , cfg .Profile , "identity profile to test" )
331341 url := fs .String ("url" , "https://get.ja3.zone/" , "fingerprint-reporting endpoint" )
332342 dataDir := fs .String ("data" , cfg .DataDir , "data directory" )
343+ upstreamProxyURL := fs .String ("upstream-proxy" , os .Getenv ("DOPPEL_UPSTREAM_PROXY" ), "upstream SOCKS5 proxy URL" )
333344 if err := fs .Parse (args ); err != nil {
334345 return err
335346 }
@@ -339,8 +350,12 @@ func cmdVerify(args []string) error {
339350 if err != nil {
340351 return err
341352 }
353+ upstreamProxy , err := upstream .ParseProxy (* upstreamProxyURL )
354+ if err != nil {
355+ return err
356+ }
342357
343- rt := & upstream.RoundTripper {Dialer : & upstream.Dialer {}, Profile : selected }
358+ rt := & upstream.RoundTripper {Dialer : & upstream.Dialer {UpstreamProxy : upstreamProxy }, Profile : selected }
344359 defer rt .Close ()
345360
346361 req , err := http .NewRequest (http .MethodGet , * url , nil )
0 commit comments