mirror of
https://github.com/qdm12/ddns-updater.git
synced 2026-04-05 00:43:53 -04:00
fix(publicip/dns): use address of Cloudflare for ipv4 or ipv6
This commit is contained in:
@@ -24,7 +24,7 @@ func fetch(ctx context.Context, client Client, network string,
|
||||
var serverHost string
|
||||
switch network {
|
||||
case "tcp":
|
||||
serverHost = providerData.TLSName
|
||||
serverHost = providerData.Address
|
||||
case "tcp4":
|
||||
serverHost = providerData.IPv4.String()
|
||||
case "tcp6":
|
||||
|
||||
@@ -102,12 +102,12 @@ func Test_fetch(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
client := mock_dns.NewMockClient(ctrl)
|
||||
expectedAddress := net.JoinHostPort(providerData.TLSName, "853")
|
||||
expectedAddress := net.JoinHostPort(providerData.Address, "853")
|
||||
client.EXPECT().
|
||||
ExchangeContext(ctx, expectedMessage, expectedAddress).
|
||||
Return(testCase.response, time.Millisecond, testCase.exchangeErr)
|
||||
|
||||
const network = "tcp" // so it picks the TLSName field as the address
|
||||
const network = "tcp" // so it picks the Address field as the address
|
||||
publicIPs, err := fetch(ctx, client, network, providerData)
|
||||
|
||||
if testCase.err != nil {
|
||||
|
||||
Reference in New Issue
Block a user