Documentation ¶
Index ¶
- Constants
- func BigIntToPaddedString(x *big.Int) string
- func DirectoryExists(p string) error
- func ExtractMethod(fullMethod string) string
- func FileExists(p string) error
- func ForwardMetadata(ctx context.Context) context.Context
- func GenerateCert(ethpriv *ecdsa.PrivateKey, validPeriod time.Duration) (cert []byte, key []byte, err error)
- func GetDefaultConfigDir() (string, error)
- func GetDefaultKeyStoreDir() (string, error)
- func GetPlatformName() string
- func GetUserHomeDir() (homeDir string, err error)
- func HexToAddress(hex string) (common.Address, error)
- func NewTLS(c *tls.Config) credentials.TransportCredentials
- func ParseBigInt(s string) (*big.Int, error)
- func StartPrometheus(ctx context.Context, listenAddr string)
- func StringToEtherPrice(s string) (*big.Int, error)
- type HitlessCertRotator
- type ImmediateTicker
Constants ¶
const ( FormattedBigIntLength = 80 HomeConfigDir = ".sonm" DefaultKeystorePath = "keystore" )
const (
WorkerAddressHeader = "x-worker-eth-addr"
)
Variables ¶
This section is empty.
Functions ¶
func BigIntToPaddedString ¶ added in v0.4.1
func DirectoryExists ¶ added in v0.3.0
DirectoryExists returns true if the given directory exists
func ExtractMethod ¶ added in v0.3.0
func FileExists ¶ added in v0.4.1
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 GetDefaultConfigDir ¶ added in v0.4.1
GetDefaultConfigDir returns default user's config dir. e.g: /home/user/.sonm
func GetDefaultKeyStoreDir ¶ added in v0.4.1
GetDefaultKeyStoreDir returns default keystore dir for current user. e.g: /home/user/.sonm/keystore
func GetPlatformName ¶ added in v0.3.0
func GetPlatformName() string
func GetUserHomeDir ¶ added in v0.3.0
GetUserHomeDir returns home for current user. e.g: /home/user
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 ParseBigInt ¶ added in v0.3.0
ParseBigInt parses the given string and converts it to *big.Int
func StartPrometheus ¶ added in v0.3.2
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()