2 Commits

Author SHA1 Message Date
Alec Scott
05cc6b08ce Merge pull request #15 from hyprspace/feature/dht-client
Switch to DHTClient Mode & Build Smaller Binaries
2021-06-26 10:36:58 -07:00
Alec Scott
1e23bdb2e0 Switch to DHTClient Mode & Build Smaller Binaries 2021-06-26 10:33:08 -07:00
3 changed files with 4 additions and 5 deletions

View File

@@ -7,6 +7,6 @@ do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
env GOOS=$GOOS GOARCH=$GOARCH go build -ldflags "-X github.com/hyprspace/hyprspace/cli.appVersion=$1" -o hyprspace-$1-${GOOS}-${GOARCH} .
env GOOS=$GOOS GOARCH=$GOARCH CGO_ENABLED=0 go build -ldflags "-s -w -X github.com/hyprspace/hyprspace/cli.appVersion=$1" -o hyprspace-$1-${GOOS}-${GOARCH} .
done

1
go.mod
View File

@@ -6,6 +6,7 @@ require (
github.com/DataDrake/cli-ng/v2 v2.0.2
github.com/hashicorp/go-version v1.2.1 // indirect
github.com/inconshreveable/go-update v0.0.0-20160112193335-8152e7eb6ccf
github.com/ipfs/go-datastore v0.4.5
github.com/kr/text v0.2.0 // indirect
github.com/libp2p/go-libp2p v0.14.1
github.com/libp2p/go-libp2p-core v0.8.5

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"sync"
"github.com/ipfs/go-datastore"
"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/host"
@@ -38,10 +39,7 @@ func CreateNode(ctx context.Context, inputKey string, port int, handler network.
node.SetStreamHandler(Protocol, handler)
// Create DHT Subsystem
dhtOut, err = dht.New(ctx, node)
if err != nil {
return
}
dhtOut = dht.NewDHTClient(ctx, node, datastore.NewMapDatastore())
// Define Bootstrap Nodes.
peers := []string{