good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
148de1c8
Commit
148de1c8
authored
Dec 14, 2014
by
Viktor Trón
Browse files
Options
Downloads
Patches
Plain Diff
adapt xeth pkg to new backend. FIXME JSPeer peer info
parent
76070b46
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
xeth/hexface.go
+2
-7
2 additions, 7 deletions
xeth/hexface.go
xeth/js_types.go
+31
-34
31 additions, 34 deletions
xeth/js_types.go
xeth/world.go
+2
-3
2 additions, 3 deletions
xeth/world.go
with
35 additions
and
44 deletions
xeth/hexface.go
+
2
−
7
View file @
148de1c8
...
@@ -3,7 +3,6 @@ package xeth
...
@@ -3,7 +3,6 @@ package xeth
import
(
import
(
"bytes"
"bytes"
"encoding/json"
"encoding/json"
"sync/atomic"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
...
@@ -63,12 +62,8 @@ func (self *JSXEth) PeerCount() int {
...
@@ -63,12 +62,8 @@ func (self *JSXEth) PeerCount() int {
func
(
self
*
JSXEth
)
Peers
()
[]
JSPeer
{
func
(
self
*
JSXEth
)
Peers
()
[]
JSPeer
{
var
peers
[]
JSPeer
var
peers
[]
JSPeer
for
peer
:=
self
.
obj
.
Peers
()
.
Front
();
peer
!=
nil
;
peer
=
peer
.
Next
()
{
for
_
,
peer
:=
range
self
.
obj
.
Peers
()
{
p
:=
peer
.
Value
.
(
core
.
Peer
)
peers
=
append
(
peers
,
*
NewJSPeer
(
peer
))
// we only want connected peers
if
atomic
.
LoadInt32
(
p
.
Connected
())
!=
0
{
peers
=
append
(
peers
,
*
NewJSPeer
(
p
))
}
}
}
return
peers
return
peers
...
...
This diff is collapsed.
Click to expand it.
xeth/js_types.go
+
31
−
34
View file @
148de1c8
package
xeth
package
xeth
import
(
import
(
"fmt"
"strconv"
"strings"
"strings"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/state"
)
)
...
@@ -155,38 +154,36 @@ func NewPReciept(contractCreation bool, creationAddress, hash, address []byte) *
...
@@ -155,38 +154,36 @@ func NewPReciept(contractCreation bool, creationAddress, hash, address []byte) *
// Peer interface exposed to QML
// Peer interface exposed to QML
type
JSPeer
struct
{
type
JSPeer
struct
{
ref
*
core
.
Peer
ref
*
p2p
.
Peer
Inbound
bool
`json:"isInbound"`
// Inbound bool `json:"isInbound"`
LastSend
int64
`json:"lastSend"`
// LastSend int64 `json:"lastSend"`
LastPong
int64
`json:"lastPong"`
// LastPong int64 `json:"lastPong"`
Ip
string
`json:"ip"`
// Ip string `json:"ip"`
Port
int
`json:"port"`
// Port int `json:"port"`
Version
string
`json:"version"`
// Version string `json:"version"`
LastResponse
string
`json:"lastResponse"`
// LastResponse string `json:"lastResponse"`
Latency
string
`json:"latency"`
// Latency string `json:"latency"`
Caps
string
`json:"caps"`
// Caps string `json:"caps"`
}
}
func
NewJSPeer
(
peer
core
.
Peer
)
*
JSPeer
{
func
NewJSPeer
(
peer
*
p2p
.
Peer
)
*
JSPeer
{
if
peer
==
nil
{
return
nil
// var ip []string
}
// for _, i := range peer.Host() {
// ip = append(ip, strconv.Itoa(int(i)))
var
ip
[]
string
// }
for
_
,
i
:=
range
peer
.
Host
()
{
// ipAddress := strings.Join(ip, ".")
ip
=
append
(
ip
,
strconv
.
Itoa
(
int
(
i
)))
}
// var caps []string
ipAddress
:=
strings
.
Join
(
ip
,
"."
)
// capsIt := peer.Caps().NewIterator()
// for capsIt.Next() {
var
caps
[]
string
// cap := capsIt.Value().Get(0).Str()
capsIt
:=
peer
.
Caps
()
.
NewIterator
()
// ver := capsIt.Value().Get(1).Uint()
for
capsIt
.
Next
()
{
// caps = append(caps, fmt.Sprintf("%s/%d", cap, ver))
cap
:=
capsIt
.
Value
()
.
Get
(
0
)
.
Str
()
// }
ver
:=
capsIt
.
Value
()
.
Get
(
1
)
.
Uint
()
caps
=
append
(
caps
,
fmt
.
Sprintf
(
"%s/%d"
,
cap
,
ver
))
return
&
JSPeer
{
ref
:
peer
}
}
// return &JSPeer{ref: &peer, Inbound: peer.Inbound(), LastSend: peer.LastSend().Unix(), LastPong: peer.LastPong(), Version: peer.Version(), Ip: ipAddress, Port: int(peer.Port()), Latency: peer.PingTime(), Caps: "[" + strings.Join(caps, ", ") + "]"}
return
&
JSPeer
{
ref
:
&
peer
,
Inbound
:
peer
.
Inbound
(),
LastSend
:
peer
.
LastSend
()
.
Unix
(),
LastPong
:
peer
.
LastPong
(),
Version
:
peer
.
Version
(),
Ip
:
ipAddress
,
Port
:
int
(
peer
.
Port
()),
Latency
:
peer
.
PingTime
(),
Caps
:
"["
+
strings
.
Join
(
caps
,
", "
)
+
"]"
}
}
}
type
JSReceipt
struct
{
type
JSReceipt
struct
{
...
...
This diff is collapsed.
Click to expand it.
xeth/world.go
+
2
−
3
View file @
148de1c8
package
xeth
package
xeth
import
(
import
(
"container/list"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/state"
"github.com/ethereum/go-ethereum/state"
)
)
...
@@ -55,7 +54,7 @@ func (self *World) IsListening() bool {
...
@@ -55,7 +54,7 @@ func (self *World) IsListening() bool {
return
self
.
pipe
.
obj
.
IsListening
()
return
self
.
pipe
.
obj
.
IsListening
()
}
}
func
(
self
*
World
)
Peers
()
*
list
.
List
{
func
(
self
*
World
)
Peers
()
[]
*
p2p
.
Peer
{
return
self
.
pipe
.
obj
.
Peers
()
return
self
.
pipe
.
obj
.
Peers
()
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment