Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
d27472cc
Commit
d27472cc
authored
Sep 16, 2016
by
Felix Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/v5test: delete the v5test tool
parent
80ea44c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
101 deletions
+0
-101
main.go
cmd/v5test/main.go
+0
-101
No files found.
cmd/v5test/main.go
deleted
100644 → 0
View file @
80ea44c4
// Copyright 2016 The go-ethereum Authors
// This file is part of go-ethereum.
//
// go-ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// go-ethereum is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with go-ethereum. If not, see <http://www.gnu.org/licenses/>.
// bootnode runs a bootstrap node for the Ethereum Discovery Protocol.
package
main
import
(
"flag"
"fmt"
"math/rand"
"strconv"
"time"
"github.com/ethereum/go-ethereum/cmd/utils"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/logger/glog"
"github.com/ethereum/go-ethereum/p2p/discv5"
"github.com/ethereum/go-ethereum/p2p/nat"
)
func
main
()
{
var
(
listenPort
=
flag
.
Int
(
"addr"
,
31000
,
"beginning of listening port range"
)
natdesc
=
flag
.
String
(
"nat"
,
"none"
,
"port mapping mechanism (any|none|upnp|pmp|extip:<IP>)"
)
count
=
flag
.
Int
(
"count"
,
1
,
"number of v5 topic discovery test nodes (adds default bootnodes to form a test network)"
)
regtopic
=
flag
.
String
(
"reg"
,
""
,
"topic to register on the network"
)
looktopic
=
flag
.
String
(
"search"
,
""
,
"topic to search on the network"
)
)
flag
.
Var
(
glog
.
GetVerbosity
(),
"verbosity"
,
"log verbosity (0-9)"
)
flag
.
Var
(
glog
.
GetVModule
(),
"vmodule"
,
"log verbosity pattern"
)
glog
.
SetToStderr
(
true
)
flag
.
Parse
()
natm
,
err
:=
nat
.
Parse
(
*
natdesc
)
if
err
!=
nil
{
utils
.
Fatalf
(
"-nat: %v"
,
err
)
}
for
i
:=
0
;
i
<
*
count
;
i
++
{
listenAddr
:=
":"
+
strconv
.
Itoa
(
*
listenPort
+
i
)
nodeKey
,
err
:=
crypto
.
GenerateKey
()
if
err
!=
nil
{
utils
.
Fatalf
(
"could not generate key: %v"
,
err
)
}
if
net
,
err
:=
discv5
.
ListenUDP
(
nodeKey
,
listenAddr
,
natm
,
""
);
err
!=
nil
{
utils
.
Fatalf
(
"%v"
,
err
)
}
else
{
if
err
:=
net
.
SetFallbackNodes
(
discv5
.
BootNodes
);
err
!=
nil
{
utils
.
Fatalf
(
"%v"
,
err
)
}
go
func
()
{
if
*
looktopic
==
""
{
for
i
:=
0
;
i
<
20
;
i
++
{
time
.
Sleep
(
time
.
Millisecond
*
time
.
Duration
(
2000
+
rand
.
Intn
(
2001
)))
net
.
BucketFill
()
}
}
switch
{
case
*
regtopic
!=
""
:
// register topic
fmt
.
Println
(
"Starting topic register"
)
stop
:=
make
(
chan
struct
{})
net
.
RegisterTopic
(
discv5
.
Topic
(
*
regtopic
),
stop
)
case
*
looktopic
!=
""
:
// search topic
fmt
.
Println
(
"Starting topic search"
)
stop
:=
make
(
chan
struct
{})
found
:=
make
(
chan
string
,
100
)
go
net
.
SearchTopic
(
discv5
.
Topic
(
*
looktopic
),
stop
,
found
)
for
s
:=
range
found
{
fmt
.
Println
(
time
.
Now
(),
s
)
}
default
:
// just keep doing lookups
for
{
time
.
Sleep
(
time
.
Millisecond
*
time
.
Duration
(
40000
+
rand
.
Intn
(
40001
)))
net
.
BucketFill
()
}
}
}()
}
fmt
.
Printf
(
"Started test node #%d with public key %v
\n
"
,
i
,
discv5
.
PubkeyID
(
&
nodeKey
.
PublicKey
))
}
select
{}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment