Documentation ¶
Index ¶
- func CmpPrice(x, y string) (int, error)
- func DirectoryExists(p string) bool
- func EqualAddresses(a, b common.Address) bool
- func ExtractMethod(fullMethod string) string
- func ForwardMetadata(ctx context.Context) context.Context
- func GenerateCert(ethpriv *ecdsa.PrivateKey, validPeriod time.Duration) (cert []byte, key []byte, err error)
- func GetAvailableIPs() (availableIPs []net.IP, err error)
- func GetLocalIP() string
- func GetPlatformName() string
- func GetUserHomeDir() (homeDir string, err error)
- func LoadYamlFile(from string, to interface{}) error
- func MakeGrpcClient(ctx context.Context, addr string, creds credentials.TransportCredentials, ...) (*grpc.ClientConn, error)
- func MakeGrpcServer(creds credentials.TransportCredentials, extraopts ...grpc.ServerOption) *grpc.Server
- func MakeWalletAuthenticatedClient(ctx context.Context, creds credentials.TransportCredentials, endpoint string, ...) (*grpc.ClientConn, error)
- func NewTLS(c *tls.Config) credentials.TransportCredentials
- func NewWalletAccess(wallet *SelfSignedWallet) credentials.PerRPCCredentials
- func NewWalletAuthenticator(c credentials.TransportCredentials, wallet ethcommon.Address) credentials.TransportCredentials
- func ParseBigInt(s string) (*big.Int, error)
- func ParseEndpoint(endpoint string) (string, ethcommon.Address, error)
- func ParseEndpointPort(s string) (string, error)
- func PubKeyToAddr(key ecdsa.PublicKey) common.Address
- func PubKeyToString(key ecdsa.PublicKey) string
- func VerifyEqualPrice(x, y string) error
- func VerifySelfSignedWallet(signedWallet string) (string, error)
- type EthAuthInfo
- type HitlessCertRotator
- type ImmediateTicker
- type PortBinding
- type SelfSignedWallet
- type WalletAccess
- type WalletAuthenticator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CmpPrice ¶ added in v0.3.0
CmpPrice transforms the given prices in string format and compares them, returning:
-1 if x < y 0 if x == y +1 if x > y
func DirectoryExists ¶ added in v0.3.0
DirectoryExists returns true if the given directory exists
func EqualAddresses ¶ added in v0.3.0
EqualAddresses checks if provided Addresses are equal
func ExtractMethod ¶ added in v0.3.0
func ForwardMetadata ¶ added in v0.3.0
ForwardMetadata is a helper function for gRPC proxy that chains incoming request with some outgoing request. It simply forwards incoming context metadata without changes by toggling internal outgoing key.
func GenerateCert ¶ added in v0.3.0
func GenerateCert(ethpriv *ecdsa.PrivateKey, validPeriod time.Duration) (cert []byte, key []byte, err error)
GenerateCert generates new PEM encoded x509cert and privatekey key. Generated certificate contains signature of a publick key by eth key
func GetAvailableIPs ¶ added in v0.3.0
func GetPlatformName ¶ added in v0.3.0
func GetPlatformName() string
func GetUserHomeDir ¶ added in v0.3.0
func LoadYamlFile ¶ added in v0.3.0
func MakeGrpcClient ¶ added in v0.3.0
func MakeGrpcClient(ctx context.Context, addr string, creds credentials.TransportCredentials, opts ...grpc.DialOption) (*grpc.ClientConn, error)
MakeGrpcClient creates new gRPC client connection on given addr and wraps it with given credentials
func MakeGrpcServer ¶ added in v0.3.0
func MakeGrpcServer(creds credentials.TransportCredentials, extraopts ...grpc.ServerOption) *grpc.Server
MakeGrpcServer creates new gRPC server
func MakeWalletAuthenticatedClient ¶ added in v0.3.0
func MakeWalletAuthenticatedClient(ctx context.Context, creds credentials.TransportCredentials, endpoint string, opts ...grpc.DialOption) (*grpc.ClientConn, error)
func NewTLS ¶ added in v0.3.0
func NewTLS(c *tls.Config) credentials.TransportCredentials
NewTLS wraps TLS TransportCredentials from grpc to add custom logic
func NewWalletAccess ¶ added in v0.3.0
func NewWalletAccess(wallet *SelfSignedWallet) credentials.PerRPCCredentials
NewWalletAccess constructs the new PerRPCCredentials using with given self-signed wallet.
func NewWalletAuthenticator ¶ added in v0.3.0
func NewWalletAuthenticator(c credentials.TransportCredentials, wallet ethcommon.Address) credentials.TransportCredentials
func ParseBigInt ¶ added in v0.3.0
ParseBigInt parses the given string and converts it to *big.Int
func ParseEndpoint ¶ added in v0.3.0
func ParseEndpointPort ¶ added in v0.3.0
func PubKeyToString ¶ added in v0.3.0
func VerifyEqualPrice ¶ added in v0.3.0
func VerifySelfSignedWallet ¶ added in v0.3.0
Types ¶
type EthAuthInfo ¶ added in v0.3.0
type EthAuthInfo struct { TLS credentials.TLSInfo Wallet ethcommon.Address }
EthAuthInfo implements credentials.AuthInfo It provides access to a wallet of a connected user
func (EthAuthInfo) AuthType ¶ added in v0.3.0
func (e EthAuthInfo) AuthType() string
AuthType implements credentials.AuthInfo interface
type HitlessCertRotator ¶ added in v0.3.0
type HitlessCertRotator interface { GetCertificate(*tls.ClientHelloInfo) (*tls.Certificate, error) GetClientCertificate(*tls.CertificateRequestInfo) (*tls.Certificate, error) Close() }
HitlessCertRotator renews TLS cert periodically
func NewHitlessCertRotator ¶ added in v0.3.0
func NewHitlessCertRotator(ctx context.Context, ethPriv *ecdsa.PrivateKey) (HitlessCertRotator, *tls.Config, error)
type ImmediateTicker ¶ added in v0.3.0
type ImmediateTicker struct { C <-chan time.Time // The channel on which the ticks are delivered. // contains filtered or unexported fields }
func NewImmediateTicker ¶ added in v0.3.0
func NewImmediateTicker(d time.Duration) *ImmediateTicker
func (*ImmediateTicker) Stop ¶ added in v0.3.0
func (t *ImmediateTicker) Stop()
type PortBinding ¶ added in v0.3.0
type PortBinding interface { // Network shows name of the network (for example, "tcp", "udp"). Network() string // Port describes a port. Port() uint16 }
func ParsePortBinding ¶ added in v0.3.0
func ParsePortBinding(v string) (PortBinding, error)
ParsePortBinding parses the given Docker port binding into components. For example `8080/tcp`.
type SelfSignedWallet ¶ added in v0.3.0
type SelfSignedWallet struct {
Message string
}
func NewSelfSignedWallet ¶ added in v0.3.0
func NewSelfSignedWallet(key *ecdsa.PrivateKey) (*SelfSignedWallet, error)
type WalletAccess ¶ added in v0.3.0
type WalletAccess struct {
// contains filtered or unexported fields
}
WalletAccess supplies PerRPCCredentials from a given self-signed wallet.
func (WalletAccess) GetRequestMetadata ¶ added in v0.3.0
func (WalletAccess) RequireTransportSecurity ¶ added in v0.3.0
func (c WalletAccess) RequireTransportSecurity() bool
type WalletAuthenticator ¶ added in v0.3.0
type WalletAuthenticator struct { credentials.TransportCredentials Wallet ethcommon.Address }
func (*WalletAuthenticator) ClientHandshake ¶ added in v0.3.0
func (*WalletAuthenticator) ServerHandshake ¶ added in v0.3.0
func (w *WalletAuthenticator) ServerHandshake(conn net.Conn) (net.Conn, credentials.AuthInfo, error)