Parcourir la source

Access command should use native dialer instead of network one

tags/v2.2.0^2^2
9seconds il y a 1 mois
Parent
révision
8df1629882
1 fichiers modifiés avec 6 ajouts et 1 suppressions
  1. 6
    1
      internal/cli/access.go

+ 6
- 1
internal/cli/access.go Voir le fichier

@@ -101,8 +101,13 @@ func (a *Access) Run(cli *CLI, version string) error {
101 101
 }
102 102
 
103 103
 func (a *Access) getIP(ntw mtglib.Network, protocol string) net.IP {
104
+	dialer := ntw.NativeDialer()
104 105
 	client := ntw.MakeHTTPClient(func(ctx context.Context, network, address string) (essentials.Conn, error) {
105
-		return ntw.DialContext(ctx, protocol, address) //nolint: wrapcheck
106
+		conn, err := dialer.DialContext(ctx, protocol, address)
107
+		if err != nil {
108
+			return nil, err
109
+		}
110
+		return essentials.WrapNetConn(conn), err
106 111
 	})
107 112
 
108 113
 	req, err := http.NewRequest(http.MethodGet, "https://ifconfig.co", nil) //nolint: noctx

Chargement…
Annuler
Enregistrer