Documentation
¶
Index ¶
- Constants
- Variables
- func BytesFromString(s string) []byte
- func CheckFileExists(inputPath string) bool
- func CheckValidIP(ip string) bool
- func CompAddrInfo(pid string, maddrs []ma.Multiaddr) (peer.AddrInfo, error)
- func ConvertFromInterfacePrivKey(privkey crypto.PrivKey) (*ecdsa.PrivateKey, error)
- func ConvertToInterfacePubkey(pubkey *ecdsa.PublicKey) (crypto.PubKey, error)
- func CopyFileToNewPath(oldPath string, newPath string) error
- func ExistsInArray(inputList []string, inputValue string) bool
- func ExistsInMapValue(inputMap map[string]string, inputValue string) bool
- func ExtractIPFromMAddr(maddr ma.Multiaddr) net.IP
- func FilterClientType(userAgent string) (string, string)
- func FilterError(err string) string
- func GeneratePrivKey() *crypto.Secp256k1PrivateKey
- func GetForkDigestFromENode(n enode.Node) (string, error)
- func GetForkDigestFromEth2Data(b beacon.Eth2Data) string
- func GetForkDigestFromStatus(b beacon.Status) string
- func GetPublicAddrsFromAddrArray(mAddrs []ma.Multiaddr) ma.Multiaddr
- func IsIPPublic(ip net.IP) bool
- func ParseInterfaceAddrArray(input_arr []interface{}) ([]ma.Multiaddr, error)
- func ParseInterfaceStringArray(input_arr []interface{}) []string
- func ParseInterfaceTimeArray(input_arr []interface{}) ([]time.Time, error)
- func ParseLogFormatter(lvl string) logrus.Formatter
- func ParseLogLevel(lvl string) logrus.Level
- func ParseLogOutput(lvl string) io.Writer
- func ParseNodeEth2Data(n enode.Node) (data *beacon.Eth2Data, exists bool, err error)
- func ParsePrivateKey(v string) (*crypto.Secp256k1PrivateKey, error)
- func ParsePubkey(v string) (*ecdsa.PublicKey, error)
- func PrivKeyToString(input_key *crypto.Secp256k1PrivateKey) string
- func ReturnGreatestTime(input_array []time.Time) time.Time
- func ReturnMaxInt(input_array []int) int
- func UnmarshalMaddr(inputAddr string) (ma.Multiaddr, error)
- type AttnetsENREntry
- type Eth2ENREntry
Constants ¶
const ATTNETS_KEY = "attnets"
const ETH2_ENR_KEY = "eth2"
const MADDR_SEPARATOR string = "/"
Variables ¶
var ( DefaultLoglvl = logrus.InfoLevel DefaultLogOutput = os.Stdout DefaultFormater = &logrus.TextFormatter{} )
App default configurations
var (
ModuleName = "UTILS"
)
Functions ¶
func BytesFromString ¶ added in v1.1.0
func CheckFileExists ¶
func CheckValidIP ¶
checkvalidIP * This method checks whether the IP can be parsed or not
func CompAddrInfo ¶ added in v1.1.0
func ConvertFromInterfacePrivKey ¶ added in v1.1.0
func ConvertFromInterfacePrivKey(privkey crypto.PrivKey) (*ecdsa.PrivateKey, error)
taken from Prysm https://github.com/prysmaticlabs/prysm/blob/616cfd33908df1e479c5dd0980367ede8de82a5d/crypto/ecdsa/utils.go#L13
func ConvertToInterfacePubkey ¶ added in v1.1.0
taken from Prysm https://github.com/prysmaticlabs/prysm/blob/616cfd33908df1e479c5dd0980367ede8de82a5d/crypto/ecdsa/utils.go#L38
func CopyFileToNewPath ¶
func ExistsInArray ¶
func FilterClientType ¶ added in v1.1.0
Gets the client and version for a given userAgent. TODO: Perhaps use some regex
func FilterError ¶ added in v1.1.0
Funtion that formats the error into a Pretty understandable (standard) way. Also important to cohesionate the extra-metrics output csv.
func GeneratePrivKey ¶ added in v1.1.0
func GeneratePrivKey() *crypto.Secp256k1PrivateKey
func GetForkDigestFromStatus ¶
func GetPublicAddrsFromAddrArray ¶ added in v1.1.0
func IsIPPublic ¶
func ParseInterfaceAddrArray ¶
func ParseInterfaceStringArray ¶
func ParseInterfaceStringArray(input_arr []interface{}) []string
func ParseInterfaceTimeArray ¶
func ParseLogFormatter ¶
parse Formatter from string
func ParseNodeEth2Data ¶
ParseNodeEth2Data * This method will parse the Node and obtain information about it @param n: the enode from where to get the information @return the Eth2Data object from the beacon package
func ParsePrivateKey ¶
func ParsePrivateKey(v string) (*crypto.Secp256k1PrivateKey, error)
Parse a Secp256k1PrivateKey from string, checking if it has the proper curve
func PrivKeyToString ¶
func PrivKeyToString(input_key *crypto.Secp256k1PrivateKey) string
Export Private Key to a string
func ReturnGreatestTime ¶
ReturnGreatestTime * This method return the latest time inside the given array @param input_array: the array of times to compare @return the latest time inside the array
func ReturnMaxInt ¶
Types ¶
type AttnetsENREntry ¶
type AttnetsENREntry []byte
TODO: Comment Attended networks are the networks the node will be participating in
func NewAttnetsENREntry ¶
func NewAttnetsENREntry(input_bytes string) AttnetsENREntry
func (AttnetsENREntry) ENRKey ¶
func (aee AttnetsENREntry) ENRKey() string
type Eth2ENREntry ¶
type Eth2ENREntry []byte
With this entry we allow the node to have a registered fork digest
func NewEth2DataEntry ¶
func NewEth2DataEntry(input_bytes string) Eth2ENREntry
func (Eth2ENREntry) ENRKey ¶
func (eee Eth2ENREntry) ENRKey() string