Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 7b7caf9

Browse files
committed
Update to support Tor connections and update command
1 parent 52861e8 commit 7b7caf9

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

core/core.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,26 @@ func (n *OpenBazaarNode) SeedNode() error {
159159
n.RootHash = rootHash
160160

161161
go func() {
162-
// Ping search endpoint with published hash
162+
// Update search endpoint with published hash
163163
peerId, _ := n.GetNodeID()
164-
endpoint := fmt.Sprintf("https://search.ob1.io/ping/%s/%s", peerId.PeerID, rootHash)
164+
endpoint := fmt.Sprintf("https://search.ob1.io/update/%s/%s", peerId.PeerID, rootHash)
165165
log.Infof("Publishing new rootHash to: %s\n", endpoint)
166-
resp, err := http.Get(endpoint)
166+
167+
var client *http.Client
168+
if n.TorDialer != nil {
169+
tbTransport := &http.Transport{Dial: n.TorDialer.Dial}
170+
client = &http.Client{Transport: tbTransport, Timeout: time.Second * 30}
171+
} else {
172+
client = &http.Client{Timeout: time.Second * 30}
173+
}
174+
175+
resp, err := client.Get(endpoint)
167176
if err != nil {
168-
log.Errorf("Search Ping did not succeed. %v\n", err)
177+
log.Errorf("Search update did not succeed. %v\n", err)
169178
}
170-
log.Debugf("%s respone: %v", endpoint, resp)
179+
log.Debugf("%s response: %v", endpoint, resp)
171180
}()
172-
181+
173182
n.seedLock.Unlock()
174183
n.InitalPublishComplete = true
175184
go n.publish(rootHash)

0 commit comments

Comments
 (0)