mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
Merge branch 'master' of https://github.com/ethereum/go-ethereum into ulc/master_2
This commit is contained in:
commit
1932f58429
14 changed files with 38 additions and 5504 deletions
|
|
@ -168,7 +168,7 @@ HTTP based JSON-RPC API options:
|
||||||
* `--ipcpath` Filename for IPC socket/pipe within the datadir (explicit paths escape it)
|
* `--ipcpath` Filename for IPC socket/pipe within the datadir (explicit paths escape it)
|
||||||
|
|
||||||
You'll need to use your own programming environments' capabilities (libraries, tools, etc) to connect
|
You'll need to use your own programming environments' capabilities (libraries, tools, etc) to connect
|
||||||
via HTTP, WS or IPC to a Geth node configured with the above flags and you'll need to speak [JSON-RPC](http://www.jsonrpc.org/specification)
|
via HTTP, WS or IPC to a Geth node configured with the above flags and you'll need to speak [JSON-RPC](https://www.jsonrpc.org/specification)
|
||||||
on all transports. You can reuse the same connection for multiple requests!
|
on all transports. You can reuse the same connection for multiple requests!
|
||||||
|
|
||||||
**Note: Please understand the security implications of opening up an HTTP/WS based transport before
|
**Note: Please understand the security implications of opening up an HTTP/WS based transport before
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ func cliFeedUploadAndSync(c *cli.Context) error {
|
||||||
|
|
||||||
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now())
|
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now())
|
||||||
|
|
||||||
generateEndpoints(scheme, cluster, from, to)
|
generateEndpoints(scheme, cluster, appName, from, to)
|
||||||
|
|
||||||
log.Info("generating and uploading feeds to " + endpoints[0] + " and syncing")
|
log.Info("generating and uploading feeds to " + endpoints[0] + " and syncing")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ var (
|
||||||
endpoints []string
|
endpoints []string
|
||||||
includeLocalhost bool
|
includeLocalhost bool
|
||||||
cluster string
|
cluster string
|
||||||
|
appName string
|
||||||
scheme string
|
scheme string
|
||||||
filesize int
|
filesize int
|
||||||
from int
|
from int
|
||||||
|
|
@ -49,6 +50,12 @@ func main() {
|
||||||
Usage: "cluster to point to (prod or a given namespace)",
|
Usage: "cluster to point to (prod or a given namespace)",
|
||||||
Destination: &cluster,
|
Destination: &cluster,
|
||||||
},
|
},
|
||||||
|
cli.StringFlag{
|
||||||
|
Name: "app",
|
||||||
|
Value: "swarm",
|
||||||
|
Usage: "application to point to (swarm or swarm-private)",
|
||||||
|
Destination: &appName,
|
||||||
|
},
|
||||||
cli.IntFlag{
|
cli.IntFlag{
|
||||||
Name: "cluster-from",
|
Name: "cluster-from",
|
||||||
Value: 8501,
|
Value: 8501,
|
||||||
|
|
@ -107,5 +114,6 @@ func main() {
|
||||||
err := app.Run(os.Args)
|
err := app.Run(os.Args)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err.Error())
|
log.Error(err.Error())
|
||||||
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,20 +33,19 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
colorable "github.com/mattn/go-colorable"
|
|
||||||
"github.com/pborman/uuid"
|
"github.com/pborman/uuid"
|
||||||
|
|
||||||
cli "gopkg.in/urfave/cli.v1"
|
cli "gopkg.in/urfave/cli.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
func generateEndpoints(scheme string, cluster string, from int, to int) {
|
func generateEndpoints(scheme string, cluster string, app string, from int, to int) {
|
||||||
if cluster == "prod" {
|
if cluster == "prod" {
|
||||||
for port := from; port <= to; port++ {
|
for port := from; port <= to; port++ {
|
||||||
endpoints = append(endpoints, fmt.Sprintf("%s://%v.swarm-gateways.net", scheme, port))
|
endpoints = append(endpoints, fmt.Sprintf("%s://%v.swarm-gateways.net", scheme, port))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for port := from; port <= to; port++ {
|
for port := from; port <= to; port++ {
|
||||||
endpoints = append(endpoints, fmt.Sprintf("%s://swarm-%v-%s.stg.swarm-gateways.net", scheme, port, cluster))
|
endpoints = append(endpoints, fmt.Sprintf("%s://%s-%v-%s.stg.swarm-gateways.net", scheme, app, port, cluster))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,11 +56,11 @@ func generateEndpoints(scheme string, cluster string, from int, to int) {
|
||||||
|
|
||||||
func cliUploadAndSync(c *cli.Context) error {
|
func cliUploadAndSync(c *cli.Context) error {
|
||||||
log.PrintOrigins(true)
|
log.PrintOrigins(true)
|
||||||
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(colorable.NewColorableStderr(), log.TerminalFormat(true))))
|
log.Root().SetHandler(log.LvlFilterHandler(log.Lvl(verbosity), log.StreamHandler(os.Stdout, log.TerminalFormat(true))))
|
||||||
|
|
||||||
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "size (kb)", filesize) }(time.Now())
|
defer func(now time.Time) { log.Info("total time", "time", time.Since(now), "kb", filesize) }(time.Now())
|
||||||
|
|
||||||
generateEndpoints(scheme, cluster, from, to)
|
generateEndpoints(scheme, cluster, appName, from, to)
|
||||||
|
|
||||||
log.Info("uploading to " + endpoints[0] + " and syncing")
|
log.Info("uploading to " + endpoints[0] + " and syncing")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"net"
|
"net"
|
||||||
"sort"
|
"sort"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
@ -391,7 +390,7 @@ type sharedUDPConn struct {
|
||||||
func (s *sharedUDPConn) ReadFromUDP(b []byte) (n int, addr *net.UDPAddr, err error) {
|
func (s *sharedUDPConn) ReadFromUDP(b []byte) (n int, addr *net.UDPAddr, err error) {
|
||||||
packet, ok := <-s.unhandled
|
packet, ok := <-s.unhandled
|
||||||
if !ok {
|
if !ok {
|
||||||
return 0, nil, fmt.Errorf("Connection was closed")
|
return 0, nil, errors.New("Connection was closed")
|
||||||
}
|
}
|
||||||
l := len(packet.Data)
|
l := len(packet.Data)
|
||||||
if l > len(b) {
|
if l > len(b) {
|
||||||
|
|
@ -425,7 +424,7 @@ func (srv *Server) Start() (err error) {
|
||||||
|
|
||||||
// static fields
|
// static fields
|
||||||
if srv.PrivateKey == nil {
|
if srv.PrivateKey == nil {
|
||||||
return fmt.Errorf("Server.PrivateKey must be set to a non-nil key")
|
return errors.New("Server.PrivateKey must be set to a non-nil key")
|
||||||
}
|
}
|
||||||
if srv.newTransport == nil {
|
if srv.newTransport == nil {
|
||||||
srv.newTransport = newRLPX
|
srv.newTransport = newRLPX
|
||||||
|
|
@ -903,7 +902,7 @@ func (srv *Server) setupConn(c *conn, flags connFlag, dialDest *enode.Node) erro
|
||||||
if dialDest != nil {
|
if dialDest != nil {
|
||||||
dialPubkey = new(ecdsa.PublicKey)
|
dialPubkey = new(ecdsa.PublicKey)
|
||||||
if err := dialDest.Load((*enode.Secp256k1)(dialPubkey)); err != nil {
|
if err := dialDest.Load((*enode.Secp256k1)(dialPubkey)); err != nil {
|
||||||
return fmt.Errorf("dial destination doesn't have a secp256k1 public key")
|
return errors.New("dial destination doesn't have a secp256k1 public key")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Run the encryption handshake.
|
// Run the encryption handshake.
|
||||||
|
|
@ -937,7 +936,7 @@ func (srv *Server) setupConn(c *conn, flags connFlag, dialDest *enode.Node) erro
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if id := c.node.ID(); !bytes.Equal(crypto.Keccak256(phs.ID), id[:]) {
|
if id := c.node.ID(); !bytes.Equal(crypto.Keccak256(phs.ID), id[:]) {
|
||||||
clog.Trace("Wrong devp2p handshake identity", "phsid", fmt.Sprintf("%x", phs.ID))
|
clog.Trace("Wrong devp2p handshake identity", "phsid", hex.EncodeToString(phs.ID))
|
||||||
return DiscUnexpectedIdentity
|
return DiscUnexpectedIdentity
|
||||||
}
|
}
|
||||||
c.caps, c.name = phs.Caps, phs.Name
|
c.caps, c.name = phs.Caps, phs.Name
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ type SignerUI interface {
|
||||||
// OnSignerStartup is invoked when the signer boots, and tells the UI info about external API location and version
|
// OnSignerStartup is invoked when the signer boots, and tells the UI info about external API location and version
|
||||||
// information
|
// information
|
||||||
OnSignerStartup(info StartupInfo)
|
OnSignerStartup(info StartupInfo)
|
||||||
// OnInputRequried is invoked when clef requires user input, for example master password or
|
// OnInputRequired is invoked when clef requires user input, for example master password or
|
||||||
// pin-code for unlocking hardware wallets
|
// pin-code for unlocking hardware wallets
|
||||||
OnInputRequired(info UserInputRequest) (UserInputResponse, error)
|
OnInputRequired(info UserInputRequest) (UserInputResponse, error)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -164,6 +164,10 @@ func (pssapi *API) SendSym(symkeyhex string, topic Topic, msg hexutil.Bytes) err
|
||||||
return pssapi.Pss.SendSym(symkeyhex, topic, msg[:])
|
return pssapi.Pss.SendSym(symkeyhex, topic, msg[:])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (pssapi *API) SendRaw(addr hexutil.Bytes, topic Topic, msg hexutil.Bytes) error {
|
||||||
|
return pssapi.Pss.SendRaw(PssAddress(addr), topic, msg[:])
|
||||||
|
}
|
||||||
|
|
||||||
func (pssapi *API) GetPeerTopics(pubkeyhex string) ([]Topic, error) {
|
func (pssapi *API) GetPeerTopics(pubkeyhex string) ([]Topic, error) {
|
||||||
topics, _, err := pssapi.Pss.GetPublickeyPeers(pubkeyhex)
|
topics, _, err := pssapi.Pss.GetPublickeyPeers(pubkeyhex)
|
||||||
return topics, err
|
return topics, err
|
||||||
|
|
|
||||||
|
|
@ -1064,7 +1064,7 @@ func testSendRaw(t *testing.T) {
|
||||||
|
|
||||||
// send and verify delivery
|
// send and verify delivery
|
||||||
lmsg := []byte("plugh")
|
lmsg := []byte("plugh")
|
||||||
err = clients[1].Call(nil, "pss_sendRaw", loaddrhex, topic, lmsg)
|
err = clients[1].Call(nil, "pss_sendRaw", loaddrhex, topic, hexutil.Encode(lmsg))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
@ -1077,7 +1077,7 @@ func testSendRaw(t *testing.T) {
|
||||||
t.Fatalf("test message (left) timed out: %v", cerr)
|
t.Fatalf("test message (left) timed out: %v", cerr)
|
||||||
}
|
}
|
||||||
rmsg := []byte("xyzzy")
|
rmsg := []byte("xyzzy")
|
||||||
err = clients[0].Call(nil, "pss_sendRaw", roaddrhex, topic, rmsg)
|
err = clients[0].Call(nil, "pss_sendRaw", roaddrhex, topic, hexutil.Encode(rmsg))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
4
vendor/github.com/karalabe/hid/appveyor.yml
generated
vendored
4
vendor/github.com/karalabe/hid/appveyor.yml
generated
vendored
|
|
@ -22,8 +22,8 @@ environment:
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- rmdir C:\go /s /q
|
- rmdir C:\go /s /q
|
||||||
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.8.windows-%GOARCH%.zip
|
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.10.1.windows-%GOARCH%.zip
|
||||||
- 7z x go1.8.windows-%GOARCH%.zip -y -oC:\ > NUL
|
- 7z x go1.10.1.windows-%GOARCH%.zip -y -oC:\ > NUL
|
||||||
- go version
|
- go version
|
||||||
- gcc --version
|
- gcc --version
|
||||||
|
|
||||||
|
|
|
||||||
2
vendor/github.com/karalabe/hid/hid_disabled.go
generated
vendored
2
vendor/github.com/karalabe/hid/hid_disabled.go
generated
vendored
|
|
@ -36,7 +36,7 @@ func (info DeviceInfo) Open() (*Device, error) {
|
||||||
|
|
||||||
// Close releases the HID USB device handle. On platforms that this file implements
|
// Close releases the HID USB device handle. On platforms that this file implements
|
||||||
// the method is just a noop.
|
// the method is just a noop.
|
||||||
func (dev *Device) Close() {}
|
func (dev *Device) Close() error { return nil }
|
||||||
|
|
||||||
// Write sends an output report to a HID device. On platforms that this file
|
// Write sends an output report to a HID device. On platforms that this file
|
||||||
// implements the method just returns an error.
|
// implements the method just returns an error.
|
||||||
|
|
|
||||||
12
vendor/github.com/karalabe/hid/hid_enabled.go
generated
vendored
12
vendor/github.com/karalabe/hid/hid_enabled.go
generated
vendored
|
|
@ -41,6 +41,7 @@ package hid
|
||||||
#endif
|
#endif
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
@ -57,11 +58,6 @@ import (
|
||||||
// > "subsequent calls will cause the hid manager to release previously enumerated devices"
|
// > "subsequent calls will cause the hid manager to release previously enumerated devices"
|
||||||
var enumerateLock sync.Mutex
|
var enumerateLock sync.Mutex
|
||||||
|
|
||||||
func init() {
|
|
||||||
// Initialize the HIDAPI library
|
|
||||||
C.hid_init()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Supported returns whether this platform is supported by the HID library or not.
|
// Supported returns whether this platform is supported by the HID library or not.
|
||||||
// The goal of this method is to allow programatically handling platforms that do
|
// The goal of this method is to allow programatically handling platforms that do
|
||||||
// not support USB HID and not having to fall back to build constraints.
|
// not support USB HID and not having to fall back to build constraints.
|
||||||
|
|
@ -113,6 +109,9 @@ func Enumerate(vendorID uint16, productID uint16) []DeviceInfo {
|
||||||
|
|
||||||
// Open connects to an HID device by its path name.
|
// Open connects to an HID device by its path name.
|
||||||
func (info DeviceInfo) Open() (*Device, error) {
|
func (info DeviceInfo) Open() (*Device, error) {
|
||||||
|
enumerateLock.Lock()
|
||||||
|
defer enumerateLock.Unlock()
|
||||||
|
|
||||||
path := C.CString(info.Path)
|
path := C.CString(info.Path)
|
||||||
defer C.free(unsafe.Pointer(path))
|
defer C.free(unsafe.Pointer(path))
|
||||||
|
|
||||||
|
|
@ -135,7 +134,7 @@ type Device struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close releases the HID USB device handle.
|
// Close releases the HID USB device handle.
|
||||||
func (dev *Device) Close() {
|
func (dev *Device) Close() error {
|
||||||
dev.lock.Lock()
|
dev.lock.Lock()
|
||||||
defer dev.lock.Unlock()
|
defer dev.lock.Unlock()
|
||||||
|
|
||||||
|
|
@ -143,6 +142,7 @@ func (dev *Device) Close() {
|
||||||
C.hid_close(dev.device)
|
C.hid_close(dev.device)
|
||||||
dev.device = nil
|
dev.device = nil
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write sends an output report to a HID device.
|
// Write sends an output report to a HID device.
|
||||||
|
|
|
||||||
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
|
|
@ -267,10 +267,10 @@
|
||||||
"revisionTime": "2017-04-30T22:20:11Z"
|
"revisionTime": "2017-04-30T22:20:11Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "UpjhOUZ1+0zNt+iIvdtECSHXmTs=",
|
"checksumSHA1": "6XsjAARQFvlW6dS15al0ibTFPOQ=",
|
||||||
"path": "github.com/karalabe/hid",
|
"path": "github.com/karalabe/hid",
|
||||||
"revision": "f00545f9f3748e591590be3732d913c77525b10f",
|
"revision": "d815e0c1a2e2082a287a2806bc90bc8fc7b276a9",
|
||||||
"revisionTime": "2017-08-21T10:38:37Z",
|
"revisionTime": "2018-11-28T19:21:57Z",
|
||||||
"tree": true
|
"tree": true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue