@@ -161,25 +161,25 @@ func SpeedTest(c *cli.Context) error {
161161 network = "ip"
162162 }
163163
164- transport := http .DefaultTransport .(* http.Transport ).Clone ()
165-
166- if caCertFileName := c .String (defs .OptionCACert ); caCertFileName != "" {
167- caCert , err := ioutil .ReadFile (caCertFileName )
168- if err != nil {
169- log .Fatal (err )
170- }
171- caCertPool := x509 .NewCertPool ()
172- caCertPool .AppendCertsFromPEM (caCert )
173-
174- transport .TLSClientConfig = & tls.Config {
175- InsecureSkipVerify : c .Bool (defs .OptionSkipCertVerify ),
176- RootCAs : caCertPool ,
177- }
178- } else {
179- transport .TLSClientConfig = & tls.Config {
180- InsecureSkipVerify : c .Bool (defs .OptionSkipCertVerify ),
181- }
182- }
164+ transport := http .DefaultTransport .(* http.Transport ).Clone ()
165+
166+ if caCertFileName := c .String (defs .OptionCACert ); caCertFileName != "" {
167+ caCert , err := ioutil .ReadFile (caCertFileName )
168+ if err != nil {
169+ log .Fatal (err )
170+ }
171+ caCertPool := x509 .NewCertPool ()
172+ caCertPool .AppendCertsFromPEM (caCert )
173+
174+ transport .TLSClientConfig = & tls.Config {
175+ InsecureSkipVerify : c .Bool (defs .OptionSkipCertVerify ),
176+ RootCAs : caCertPool ,
177+ }
178+ } else {
179+ transport .TLSClientConfig = & tls.Config {
180+ InsecureSkipVerify : c .Bool (defs .OptionSkipCertVerify ),
181+ }
182+ }
183183
184184 dialer := & net.Dialer {
185185 Timeout : 30 * time .Second ,
@@ -195,9 +195,13 @@ func SpeedTest(c *cli.Context) error {
195195 }
196196
197197 // bind to interface if given
198- if iface := c .String (defs .OptionInterface ); iface != "" {
198+ // bind to interface if given
199+ iface := c .String (defs .OptionInterface )
200+ fwmark := c .Int (defs .OptionFwmark )
201+
202+ if iface != "" || fwmark > 0 {
199203 var err error
200- dialer , err = newDialerInterfaceBound (iface )
204+ dialer , err = newDialerInterfaceOrFwmarkBound (iface , fwmark )
201205 if err != nil {
202206 return err
203207 }
0 commit comments