Skip to content

Commit

Permalink
fix: Remove dnsconfig* . Set net.DefaultResolver in NewNode.
Browse files Browse the repository at this point in the history
Also remove unneeded "hacky" method IPFS.setDNSPair .

Signed-off-by: jefft0 <jeff@thefirst.org>
  • Loading branch information
jefft0 committed Sep 13, 2022
1 parent 9181c6a commit 86863cf
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,6 @@ public void testNullParams() throws Exception {
fail("new IPFS() should fail with a null repoPath");
} catch (Exception e) { /* ignore */ }


// DNS pair setter tests
try {
IPFS.setDNSPair(null, "foo");
fail("setDNSPair() should fail with a null primary");
} catch (Exception e) { /* ignore */ }

try {
IPFS.setDNSPair("foo", null);
fail("setDNSPair() should fail with a null secondary");
} catch (Exception e) { /* ignore */ }


// Request tests
try {
ipfs.newRequest(null);
Expand Down
13 changes: 0 additions & 13 deletions android/bridge/src/main/java/ipfs/gomobile/android/IPFS.java
Original file line number Diff line number Diff line change
Expand Up @@ -332,19 +332,6 @@ synchronized public String serveGatewayMultiaddr(@NonNull String multiaddr, @Non
}
}

/**
* Sets the primary and secondary DNS for gomobile (hacky, will be removed in future version)
*
* @param primary The primary DNS address in the form {@code <ip4>:<port>}
* @param secondary The secondary DNS address in the form {@code <ip4>:<port>}
*/
public static void setDNSPair(@NonNull String primary, @NonNull String secondary) {
Objects.requireNonNull(primary, "primary should not be null");
Objects.requireNonNull(secondary, "secondary should not be null");

Core.setDNSPair(primary, secondary, false);
}

/**
* Internal helper that opens the repo if it is closed.
*
Expand Down
80 changes: 0 additions & 80 deletions go/bind/core/dnsconfig.go

This file was deleted.

79 changes: 0 additions & 79 deletions go/bind/core/dnsconfig_deprecated.go

This file was deleted.

1 change: 0 additions & 1 deletion go/bind/core/dnsconfig_empty.s

This file was deleted.

12 changes: 12 additions & 0 deletions go/bind/core/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ type Node struct {
}

func NewNode(r *Repo, driver ProximityDriver) (*Node, error) {
var dialer net.Dialer
net.DefaultResolver = &net.Resolver{
PreferGo: false,
Dial: func(context context.Context, _, _ string) (net.Conn, error) {
conn, err := dialer.DialContext(context, "udp", "84.200.69.80:53")
if err != nil {
return nil, err
}
return conn, nil
},
}

ctx := context.Background()

if _, err := loadPlugins(r.mr.Path); err != nil {
Expand Down
8 changes: 0 additions & 8 deletions ios/Bridge/GomobileIPFS/Sources/IPFS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,6 @@ public class IPFS {
return try node.serveAPI(onTCPPort: onTCPPort)
}

/// Sets the primary and secondary DNS for gomobile (hacky, will be removed in future version)
/// - Parameters:
/// - primary: The primary DNS address in the form `<ip4>:<port>`
/// - secondary: The secondary DNS address in the form `<ip4>:<port>`
public class func setDNSPair(_ primary: String, _ secondary: String) {
CoreSetDNSPair(primary, secondary, false)
}

/// Internal helper that opens the repo if it is closed
/// - Throws: `RepoError`: If the opening of the repo failed
private func openRepoIfClosed() throws {
Expand Down

0 comments on commit 86863cf

Please sign in to comment.