diff options
author | Felix Lange <fjl@twurst.com> | 2016-11-15 01:10:03 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-15 01:10:03 +0800 |
commit | 8dcea0ac0785c92df84d55b8322281e12189d8fb (patch) | |
tree | 18d9c033f86af4eda374261e4c0a165ac2c733c0 /p2p | |
parent | d89ea3e6f90c32a97bad58b82a15af0d81f4250e (diff) | |
parent | dfe79cc7845d94d14c2bc091c7eeac082f6b1e90 (diff) | |
download | dexon-8dcea0ac0785c92df84d55b8322281e12189d8fb.tar dexon-8dcea0ac0785c92df84d55b8322281e12189d8fb.tar.gz dexon-8dcea0ac0785c92df84d55b8322281e12189d8fb.tar.bz2 dexon-8dcea0ac0785c92df84d55b8322281e12189d8fb.tar.lz dexon-8dcea0ac0785c92df84d55b8322281e12189d8fb.tar.xz dexon-8dcea0ac0785c92df84d55b8322281e12189d8fb.tar.zst dexon-8dcea0ac0785c92df84d55b8322281e12189d8fb.zip |
Merge pull request #2977 from karalabe/initial-mobile-suport
mobile: initial wrappers for mobile support
Diffstat (limited to 'p2p')
-rw-r--r-- | p2p/discover/node.go | 4 | ||||
-rw-r--r-- | p2p/discv5/net.go | 8 | ||||
-rw-r--r-- | p2p/server.go | 20 |
3 files changed, 16 insertions, 16 deletions
diff --git a/p2p/discover/node.go b/p2p/discover/node.go index 139a95d80..eec0bae0c 100644 --- a/p2p/discover/node.go +++ b/p2p/discover/node.go @@ -35,7 +35,7 @@ import ( "github.com/ethereum/go-ethereum/crypto/secp256k1" ) -const nodeIDBits = 512 +const NodeIDBits = 512 // Node represents a host on the network. // The fields of Node may not be modified. @@ -209,7 +209,7 @@ func MustParseNode(rawurl string) *Node { // NodeID is a unique identifier for each node. // The node identifier is a marshaled elliptic curve public key. -type NodeID [nodeIDBits / 8]byte +type NodeID [NodeIDBits / 8]byte // NodeID prints as a long hexadecimal number. func (n NodeID) String() string { diff --git a/p2p/discv5/net.go b/p2p/discv5/net.go index 71eaec3c4..7ad6f1e5b 100644 --- a/p2p/discv5/net.go +++ b/p2p/discv5/net.go @@ -60,14 +60,6 @@ func debugLog(s string) { } } -// BootNodes are the enode URLs of the P2P bootstrap nodes for the experimental RLPx v5 "Topic Discovery" network -// warning: local bootnodes for testing!!! -var BootNodes = []*Node{ - MustParseNode("enode://0cc5f5ffb5d9098c8b8c62325f3797f56509bff942704687b6530992ac706e2cb946b90a34f1f19548cd3c7baccbcaea354531e5983c7d1bc0dee16ce4b6440b@40.118.3.223:30305"), - MustParseNode("enode://1c7a64d76c0334b0418c004af2f67c50e36a3be60b5e4790bdac0439d21603469a85fad36f2473c9a80eb043ae60936df905fa28f1ff614c3e5dc34f15dcd2dc@40.118.3.223:30308"), - MustParseNode("enode://85c85d7143ae8bb96924f2b54f1b3e70d8c4d367af305325d30a61385a432f247d2c75c45c6b4a60335060d072d7f5b35dd1d4c45f76941f62a4f83b6e75daaf@40.118.3.223:30309"), -} - // Network manages the table and all protocol interaction. type Network struct { db *nodeDB // database of known nodes diff --git a/p2p/server.go b/p2p/server.go index 649fbfb82..7381127dc 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -73,16 +73,26 @@ type Config struct { // or not. Disabling is usually useful for protocol debugging (manual topology). Discovery bool + // DiscoveryV5 specifies whether the the new topic-discovery based V5 discovery + // protocol should be started or not. DiscoveryV5 bool + // Listener address for the V5 discovery protocol UDP traffic. + DiscoveryV5Addr string + // Name sets the node name of this server. // Use common.MakeName to create a name that follows existing conventions. Name string - // Bootstrap nodes are used to establish connectivity + // BootstrapNodes are used to establish connectivity // with the rest of the network. BootstrapNodes []*discover.Node + // BootstrapNodesV5 are used to establish connectivity + // with the rest of the network using the V5 discovery + // protocol. + BootstrapNodesV5 []*discv5.Node + // Static nodes are used as pre-configured connections which are always // maintained and re-connected on disconnects. StaticNodes []*discover.Node @@ -108,8 +118,6 @@ type Config struct { // the server is started. ListenAddr string - ListenAddrV5 string - // If set to a non-nil value, the given NAT port mapper // is used to make the listening port available to the // Internet. @@ -359,11 +367,11 @@ func (srv *Server) Start() (err error) { } if srv.DiscoveryV5 { - ntab, err := discv5.ListenUDP(srv.PrivateKey, srv.ListenAddrV5, srv.NAT, "") //srv.NodeDatabase) + ntab, err := discv5.ListenUDP(srv.PrivateKey, srv.DiscoveryV5Addr, srv.NAT, "") //srv.NodeDatabase) if err != nil { return err } - if err := ntab.SetFallbackNodes(discv5.BootNodes); err != nil { + if err := ntab.SetFallbackNodes(srv.BootstrapNodesV5); err != nil { return err } srv.DiscV5 = ntab @@ -748,7 +756,7 @@ type NodeInfo struct { Protocols map[string]interface{} `json:"protocols"` } -// Info gathers and returns a collection of metadata known about the host. +// NodeInfo gathers and returns a collection of metadata known about the host. func (srv *Server) NodeInfo() *NodeInfo { node := srv.Self() |