128d20c9bf
* Upgrade geth from 1.8.15 to 1.8.18 * Update vat_tune to use shared repository methods * Query blockchain by block hash instead of block number range * Remove hash validation from repositories * Fix vow flog integration test * Update README Travis build sticker * Update constants formatting per go fmt * Update EthPublicKeyParser.ParsePublicKey to use discv5.PubkeyID method * Address PR comments
67 lines
2.0 KiB
Go
67 lines
2.0 KiB
Go
// Copyright 2018 The go-ethereum Authors
|
|
// This file is part of the go-ethereum library.
|
|
//
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package rpc
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"net"
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
// DialStdIO creates a client on stdin/stdout.
|
|
func DialStdIO(ctx context.Context) (*Client, error) {
|
|
return newClient(ctx, func(_ context.Context) (net.Conn, error) {
|
|
return stdioConn{}, nil
|
|
})
|
|
}
|
|
|
|
type stdioConn struct{}
|
|
|
|
func (io stdioConn) Read(b []byte) (n int, err error) {
|
|
return os.Stdin.Read(b)
|
|
}
|
|
|
|
func (io stdioConn) Write(b []byte) (n int, err error) {
|
|
return os.Stdout.Write(b)
|
|
}
|
|
|
|
func (io stdioConn) Close() error {
|
|
return nil
|
|
}
|
|
|
|
func (io stdioConn) LocalAddr() net.Addr {
|
|
return &net.UnixAddr{Name: "stdio", Net: "stdio"}
|
|
}
|
|
|
|
func (io stdioConn) RemoteAddr() net.Addr {
|
|
return &net.UnixAddr{Name: "stdio", Net: "stdio"}
|
|
}
|
|
|
|
func (io stdioConn) SetDeadline(t time.Time) error {
|
|
return &net.OpError{Op: "set", Net: "stdio", Source: nil, Addr: nil, Err: errors.New("deadline not supported")}
|
|
}
|
|
|
|
func (io stdioConn) SetReadDeadline(t time.Time) error {
|
|
return &net.OpError{Op: "set", Net: "stdio", Source: nil, Addr: nil, Err: errors.New("deadline not supported")}
|
|
}
|
|
|
|
func (io stdioConn) SetWriteDeadline(t time.Time) error {
|
|
return &net.OpError{Op: "set", Net: "stdio", Source: nil, Addr: nil, Err: errors.New("deadline not supported")}
|
|
}
|