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
6de726f1
Commit
6de726f1
authored
Oct 08, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protocol bump
parent
b417766b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
+16
-19
peer.go
peer.go
+16
-19
No files found.
peer.go
View file @
6de726f1
...
...
@@ -24,7 +24,7 @@ const (
// The size of the output buffer for writing messages
outputBufferSize
=
50
// Current protocol version
ProtocolVersion
=
3
3
ProtocolVersion
=
3
4
// Current P2P version
P2PVersion
=
0
// Ethereum network version
...
...
@@ -848,26 +848,23 @@ func (p *Peer) RlpData() []interface{} {
return
[]
interface
{}{
p
.
host
,
p
.
port
,
p
.
pubkey
}
}
func
packAddr
(
address
,
port
string
)
([]
byte
,
uint16
)
{
addr
:=
strings
.
Split
(
address
,
"."
)
a
,
_
:=
strconv
.
Atoi
(
addr
[
0
])
b
,
_
:=
strconv
.
Atoi
(
addr
[
1
])
c
,
_
:=
strconv
.
Atoi
(
addr
[
2
])
d
,
_
:=
strconv
.
Atoi
(
addr
[
3
])
host
:=
[]
byte
{
byte
(
a
),
byte
(
b
),
byte
(
c
),
byte
(
d
)}
prt
,
_
:=
strconv
.
Atoi
(
port
)
func
packAddr
(
address
,
_port
string
)
(
host
[]
byte
,
port
uint16
)
{
p
,
_
:=
strconv
.
Atoi
(
_port
)
port
=
uint16
(
p
)
return
host
,
uint16
(
prt
)
h
:=
net
.
ParseIP
(
address
)
if
ip
:=
h
.
To4
();
ip
!=
nil
{
host
=
[]
byte
(
ip
)
}
else
{
host
=
[]
byte
(
h
)
}
return
}
func
unpackAddr
(
value
*
ethutil
.
Value
,
p
uint64
)
string
{
byts
:=
value
.
Bytes
()
a
:=
strconv
.
Itoa
(
int
(
byts
[
0
]))
b
:=
strconv
.
Itoa
(
int
(
byts
[
1
]))
c
:=
strconv
.
Itoa
(
int
(
byts
[
2
]))
d
:=
strconv
.
Itoa
(
int
(
byts
[
3
]))
host
:=
strings
.
Join
([]
string
{
a
,
b
,
c
,
d
},
"."
)
port
:=
strconv
.
Itoa
(
int
(
p
))
return
net
.
JoinHostPort
(
host
,
port
)
host
,
_
:=
net
.
IP
(
value
.
Bytes
())
.
MarshalText
()
prt
:=
strconv
.
Itoa
(
int
(
p
))
return
net
.
JoinHostPort
(
string
(
host
),
prt
)
}
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