forked from bittorrent/go-btfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf: using ECDSA to generate node id
- Loading branch information
1 parent
036c061
commit 75d527b
Showing
3 changed files
with
54 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,39 @@ | ||
--- [email protected]/init.go 2019-06-10 11:17:01.000000000 -0700 | ||
+++ /tmp/go-ipfs-config/init.go 2019-06-10 15:52:58.000000000 -0700 | ||
@@ -49,8 +49,8 @@ | ||
--- /Users/tron/work/go/pkg/mod/github.com/ipfs/[email protected]/init.go 2019-06-27 12:07:43.000000000 +0800 | ||
+++ init.go 2019-06-27 12:17:17.000000000 +0800 | ||
@@ -6,6 +6,7 @@ | ||
"fmt" | ||
"io" | ||
"time" | ||
+ "os" | ||
|
||
// setup the node mount points. | ||
Mounts: Mounts{ | ||
- IPFS: "/ipfs", | ||
- IPNS: "/ipns", | ||
+ IPFS: "/btfs", | ||
+ IPNS: "/btns", | ||
}, | ||
ci "github.com/libp2p/go-libp2p-crypto" | ||
peer "github.com/libp2p/go-libp2p-peer" | ||
@@ -156,10 +157,24 @@ | ||
return ident, errors.New("bitsize less than 1024 is considered unsafe") | ||
} | ||
|
||
- fmt.Fprintf(out, "generating %v-bit RSA keypair...", nbits) | ||
- sk, pk, err := ci.GenerateKeyPair(ci.RSA, nbits) | ||
- if err != nil { | ||
- return ident, err | ||
+ var ( | ||
+ sk ci.PrivKey | ||
+ pk ci.PubKey | ||
+ err error | ||
+ ) | ||
+ | ||
+ if os.Getenv("RSA_FLG") == "TRUE" { | ||
+ fmt.Fprintf(out, "generating %v-bit RSA keypair...", nbits) | ||
+ sk, pk, err = ci.GenerateKeyPair(ci.ECDSA, nbits) | ||
+ if err != nil { | ||
+ return ident, err | ||
+ } | ||
+ } else { | ||
+ fmt.Fprintf(out, "generating %v-bit ECDSA keypair...", nbits) | ||
+ sk, pk, err = ci.GenerateKeyPair(ci.ECDSA, nbits) | ||
+ if err != nil { | ||
+ return ident, err | ||
+ } | ||
} | ||
fmt.Fprintf(out, "done\n") | ||
|
||
Ipns: Ipns{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,4 +68,11 @@ patchdir=$GOPATH/pkg/mod/github.com/ipfs/[email protected] | |
chmod -R 777 $patchdir | ||
if ! patch -R -s -f --dry-run $patchdir/record.go < ./patches/go-ipns-v.0.0.1-record.go.patch 1>/dev/null; then | ||
patch $patchdir/record.go < ./patches/go-ipns-v.0.0.1-record.go.patch; | ||
fi | ||
|
||
# patching $GOPATH/pkg/mod/github.com/ipfs/[email protected] | ||
patchdir=$GOPATH/pkg/mod/github.com/ipfs/[email protected] | ||
chmod -R 777 $patchdir | ||
if ! patch -R -s -f --dry-run $patchdir/init.go < ./patches/go-ipfs-config-v0.0.3-init.go.patch 1>/dev/null; then | ||
patch $patchdir/init.go < ./patches/go-ipfs-config-v0.0.3-init.go.patch; | ||
fi |