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
a1f85492
Commit
a1f85492
authored
Jul 19, 2019
by
Kurkó Mihály
Committed by
Felix Lange
Jul 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
p2p: add ENR to PeerInfo (#19816)
parent
e8c9579f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
peer.go
p2p/peer.go
+9
-5
No files found.
p2p/peer.go
View file @
a1f85492
...
@@ -427,10 +427,11 @@ func (rw *protoRW) ReadMsg() (Msg, error) {
...
@@ -427,10 +427,11 @@ func (rw *protoRW) ReadMsg() (Msg, error) {
// peer. Sub-protocol independent fields are contained and initialized here, with
// peer. Sub-protocol independent fields are contained and initialized here, with
// protocol specifics delegated to all connected sub-protocols.
// protocol specifics delegated to all connected sub-protocols.
type
PeerInfo
struct
{
type
PeerInfo
struct
{
Enode
string
`json:"enode"`
// Node URL
ENR
string
`json:"enr,omitempty"`
// Ethereum Node Record
ID
string
`json:"id"`
// Unique node identifier
Enode
string
`json:"enode"`
// Node URL
Name
string
`json:"name"`
// Name of the node, including client type, version, OS, custom data
ID
string
`json:"id"`
// Unique node identifier
Caps
[]
string
`json:"caps"`
// Protocols advertised by this peer
Name
string
`json:"name"`
// Name of the node, including client type, version, OS, custom data
Caps
[]
string
`json:"caps"`
// Protocols advertised by this peer
Network
struct
{
Network
struct
{
LocalAddress
string
`json:"localAddress"`
// Local endpoint of the TCP data connection
LocalAddress
string
`json:"localAddress"`
// Local endpoint of the TCP data connection
RemoteAddress
string
`json:"remoteAddress"`
// Remote endpoint of the TCP data connection
RemoteAddress
string
`json:"remoteAddress"`
// Remote endpoint of the TCP data connection
...
@@ -450,12 +451,15 @@ func (p *Peer) Info() *PeerInfo {
...
@@ -450,12 +451,15 @@ func (p *Peer) Info() *PeerInfo {
}
}
// Assemble the generic peer metadata
// Assemble the generic peer metadata
info
:=
&
PeerInfo
{
info
:=
&
PeerInfo
{
Enode
:
p
.
Node
()
.
String
(),
Enode
:
p
.
Node
()
.
URLv4
(),
ID
:
p
.
ID
()
.
String
(),
ID
:
p
.
ID
()
.
String
(),
Name
:
p
.
Name
(),
Name
:
p
.
Name
(),
Caps
:
caps
,
Caps
:
caps
,
Protocols
:
make
(
map
[
string
]
interface
{}),
Protocols
:
make
(
map
[
string
]
interface
{}),
}
}
if
p
.
Node
()
.
Seq
()
>
0
{
info
.
ENR
=
p
.
Node
()
.
String
()
}
info
.
Network
.
LocalAddress
=
p
.
LocalAddr
()
.
String
()
info
.
Network
.
LocalAddress
=
p
.
LocalAddr
()
.
String
()
info
.
Network
.
RemoteAddress
=
p
.
RemoteAddr
()
.
String
()
info
.
Network
.
RemoteAddress
=
p
.
RemoteAddr
()
.
String
()
info
.
Network
.
Inbound
=
p
.
rw
.
is
(
inboundConn
)
info
.
Network
.
Inbound
=
p
.
rw
.
is
(
inboundConn
)
...
...
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