util

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2018 License: Apache-2.0 Imports: 36 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectoryExists added in v0.3.0

func DirectoryExists(p string) bool

DirectoryExists returns true if the given directory exists

func ExtractMethod added in v0.3.0

func ExtractMethod(fullMethod string) string

func ForwardMetadata added in v0.3.0

func ForwardMetadata(ctx context.Context) context.Context

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 GetAvailableIPs() (availableIPs []net.IP, err error)

func GetLocalIP

func GetLocalIP() string

GetLocalIP find local non-loopback ip addr

func GetPlatformName added in v0.3.0

func GetPlatformName() string

func GetUserHomeDir added in v0.3.0

func GetUserHomeDir() (homeDir string, err error)

func IsPrivateIP added in v0.3.2

func IsPrivateIP(ip net.IP) bool

func LoadYamlFile added in v0.3.0

func LoadYamlFile(from string, to interface{}) error

func NewTLS added in v0.3.0

NewTLS wraps TLS TransportCredentials from grpc to add custom logic

func ParseBigInt added in v0.3.0

func ParseBigInt(s string) (*big.Int, error)

ParseBigInt parses the given string and converts it to *big.Int

func ParseEndpointPort added in v0.3.0

func ParseEndpointPort(s string) (string, error)

func PubKeyToAddr added in v0.3.0

func PubKeyToAddr(key ecdsa.PublicKey) common.Address

func PubKeyToString added in v0.3.0

func PubKeyToString(key ecdsa.PublicKey) string

func StartPrometheus added in v0.3.2

func StartPrometheus(ctx context.Context, listenAddr string)

func StringToEtherPrice added in v0.3.2

func StringToEtherPrice(s string) (*big.Int, error)

StringToEtherPrice converts input string s to Ethereum's price present as big.Int This function expects to receive trimmed input.

Types

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()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL