Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update bootstrap_dns_android #966

Merged
merged 29 commits into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bbb1834
update with non_specified network
rurirei May 4, 2021
602e34d
remove wrongs
rurirei May 4, 2021
de31ea3
add alternative bootstrapDialer
rurirei May 4, 2021
fbdf783
do test
rurirei May 4, 2021
c7158f4
Update dns_bootstrap_android_test.go
rurirei May 4, 2021
35ffcd2
example of alternative dialer
rurirei May 4, 2021
2bf158f
public method
rurirei May 4, 2021
6dc353f
move const
rurirei May 4, 2021
60a043e
Update dns_bootstrap_android_test.go
rurirei May 4, 2021
90d5a29
no duplicated
rurirei May 4, 2021
1c12258
Rename infra/conf/dns_bootstrap_android.go to transport/internet/syst…
rurirei May 4, 2021
995f793
Update system_dns_android.go
rurirei May 4, 2021
aba9fbd
Update and rename infra/conf/dns_bootstrap_android_test.go to transpo…
rurirei May 4, 2021
88f0302
no imports
rurirei May 4, 2021
33b6d12
Update system_dns_android.go
rurirei May 4, 2021
2555128
Update system_dns_android_test.go
rurirei May 4, 2021
b98f06d
create systemDNS
rurirei May 4, 2021
066a1eb
Create system_dns_android.go
rurirei May 4, 2021
02c1267
Update system_dialer.go
rurirei May 4, 2021
528c268
call Resolver on systemDialer
rurirei May 4, 2021
4376c72
create system_dns_test.go
rurirei May 4, 2021
63a800f
resolver.LookupIP params
rurirei May 4, 2021
06129f8
param fix
rurirei May 4, 2021
56614cc
noneed TestSystemDNSResolver
rurirei May 4, 2021
f35b82c
revert: no specified resolver
rurirei May 4, 2021
00c452b
Delete system_dns.go
rurirei May 4, 2021
6033eaf
android only
rurirei May 4, 2021
b424575
android only test
rurirei May 4, 2021
f7903f2
typo
rurirei May 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions infra/conf/dns_bootstrap_android.go

This file was deleted.

28 changes: 0 additions & 28 deletions infra/conf/dns_bootstrap_test.go

This file was deleted.

1 change: 0 additions & 1 deletion transport/internet/system_dialer.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest ne

dialer := &net.Dialer{
Timeout: time.Second * 16,
DualStack: true,
LocalAddr: resolveSrcAddr(dest.Network, src),
}

Expand Down
26 changes: 26 additions & 0 deletions transport/internet/system_dns_android.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// +build android

package internet

import (
"context"
"net"
)

const SystemDNS = "8.8.8.8:53"

type DNSResolverFunc func() *net.Resolver

var NewDNSResolver DNSResolverFunc = func() *net.Resolver {
return &net.Resolver{
PreferGo: true,
Dial: func(ctx context.Context, network, _ string) (net.Conn, error) {
var dialer net.Dialer
return dialer.DialContext(ctx, network, SystemDNS)
},
}
}

func init() {
net.DefaultResolver = NewDNSResolver()
}
15 changes: 15 additions & 0 deletions transport/internet/system_dns_android_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// +build android

package internet

import (
"context"
"testing"
)

func TestDNSResolver(t *testing.T) {
resolver := NewDNSResolver()
if ips, err := resolver.LookupIP(context.Background(), "ip", "www.google.com"); err != nil {
t.Errorf("failed to lookupIP, %v, %v", ips, err)
}
}