diff options
author | Felix Lange <fjl@twurst.com> | 2015-02-07 07:15:04 +0800 |
---|---|---|
committer | Felix Lange <fjl@twurst.com> | 2015-02-07 07:46:56 +0800 |
commit | 2cf4fed11b01bb99e08b838f7df2b9396f42f758 (patch) | |
tree | c4c6a63adeaa80f9b3150cf7e58d0bdcbf05bb28 /cmd | |
parent | e34d1341022a51d8a86c4836c91e4e0ded888d27 (diff) | |
download | go-tangerine-2cf4fed11b01bb99e08b838f7df2b9396f42f758.tar.gz go-tangerine-2cf4fed11b01bb99e08b838f7df2b9396f42f758.tar.zst go-tangerine-2cf4fed11b01bb99e08b838f7df2b9396f42f758.zip |
cmd/mist, eth, javascript, p2p: use Node URLs for peer suggestions
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/mist/assets/qml/main.qml | 44 | ||||
-rw-r--r-- | cmd/mist/ui_lib.go | 12 |
2 files changed, 12 insertions, 44 deletions
diff --git a/cmd/mist/assets/qml/main.qml b/cmd/mist/assets/qml/main.qml index b1d3f2d19..45d56e795 100644 --- a/cmd/mist/assets/qml/main.qml +++ b/cmd/mist/assets/qml/main.qml @@ -205,7 +205,7 @@ ApplicationWindow { Menu { title: "Network" MenuItem { - text: "Add Peer" + text: "Connect to Node" shortcut: "Ctrl+p" onTriggered: { addPeerWin.visible = true @@ -838,60 +838,34 @@ ApplicationWindow { Window { id: addPeerWin visible: false - minimumWidth: 300 - maximumWidth: 300 + minimumWidth: 400 + maximumWidth: 400 maximumHeight: 50 minimumHeight: 50 - title: "Connect to peer" + title: "Connect to Node" - - ComboBox { + TextField { id: addrField + placeholderText: "enode://<hex node id>:<IP address>:<port>" anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.right: addPeerButton.left anchors.leftMargin: 10 anchors.rightMargin: 10 onAccepted: { - eth.connectToPeer(addrField.currentText) + eth.connectToPeer(addrField.text) addPeerWin.visible = false } - - editable: true - model: ListModel { id: pastPeers } - - Component.onCompleted: { - pastPeers.insert(0, {text: "poc-8.ethdev.com:30303"}) - /* - var ips = eth.pastPeers() - for(var i = 0; i < ips.length; i++) { - pastPeers.append({text: ips.get(i)}) - } - - pastPeers.insert(0, {text: "poc-7.ethdev.com:30303"}) - */ - } } - ComboBox { - id: nodeidField - anchors.verticalCenter: parent.verticalCenter - anchors.left: parent.left - anchors.right: addPeerButton.left - anchors.leftMargin: 10 - anchors.rightMargin: 10 - - editable: true - } - Button { id: addPeerButton anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter anchors.rightMargin: 10 - text: "Add" + text: "Connect" onClicked: { - eth.connectToPeer(addrField.currentText, nodeidField.currentText) + eth.connectToPeer(addrField.text) addPeerWin.visible = false } } diff --git a/cmd/mist/ui_lib.go b/cmd/mist/ui_lib.go index 2e557dba9..dbebd8a6f 100644 --- a/cmd/mist/ui_lib.go +++ b/cmd/mist/ui_lib.go @@ -31,7 +31,6 @@ import ( "github.com/ethereum/go-ethereum/event/filter" "github.com/ethereum/go-ethereum/javascript" "github.com/ethereum/go-ethereum/miner" - "github.com/ethereum/go-ethereum/p2p/discover" "github.com/ethereum/go-ethereum/xeth" "github.com/obscuren/qml" ) @@ -143,14 +142,9 @@ func (ui *UiLib) Connect(button qml.Object) { } } -func (ui *UiLib) ConnectToPeer(addr string, hexid string) { - id, err := discover.HexID(hexid) - if err != nil { - guilogger.Errorf("bad node ID: %v", err) - return - } - if err := ui.eth.SuggestPeer(addr, id); err != nil { - guilogger.Infoln(err) +func (ui *UiLib) ConnectToPeer(nodeURL string) { + if err := ui.eth.SuggestPeer(nodeURL); err != nil { + guilogger.Infoln("SuggestPeer error: " + err.Error()) } } |