mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 22:14:02 +03:00
Merge pull request #357 from 9seconds/access-native-dialer
Access command should use native dialer instead of network one
This commit is contained in:
@@ -101,8 +101,13 @@ func (a *Access) Run(cli *CLI, version string) error {
|
||||
}
|
||||
|
||||
func (a *Access) getIP(ntw mtglib.Network, protocol string) net.IP {
|
||||
dialer := ntw.NativeDialer()
|
||||
client := ntw.MakeHTTPClient(func(ctx context.Context, network, address string) (essentials.Conn, error) {
|
||||
return ntw.DialContext(ctx, protocol, address) //nolint: wrapcheck
|
||||
conn, err := dialer.DialContext(ctx, protocol, address)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return essentials.WrapNetConn(conn), err
|
||||
})
|
||||
|
||||
req, err := http.NewRequest(http.MethodGet, "https://ifconfig.co", nil) //nolint: noctx
|
||||
|
||||
Reference in New Issue
Block a user