Version: v1.1.0 Latest Latest

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

Go to latest
Published: Sep 1, 2022 License: MIT Imports: 23 Imported by: 2




View Source
const ATTNETS_KEY = "attnets"
View Source
const ETH2_ENR_KEY = "eth2"
View Source
const MADDR_SEPARATOR string = "/"


View Source
var (
	DefaultLoglvl    = logrus.InfoLevel
	DefaultLogOutput = os.Stdout
	DefaultFormater  = &logrus.TextFormatter{}

App default configurations

View Source
var (
	ModuleName = "UTILS"
View Source
var PrivateIPNetworks = []net.IPNet{
		IP:   net.ParseIP(""),
		Mask: net.CIDRMask(8, 32),
		IP:   net.ParseIP(""),
		Mask: net.CIDRMask(12, 32),
		IP:   net.ParseIP(""),
		Mask: net.CIDRMask(16, 32),


func BytesFromString added in v1.1.0

func BytesFromString(s string) []byte

func CheckFileExists

func CheckFileExists(inputPath string) bool

func CheckValidIP

func CheckValidIP(ip string) bool

checkvalidIP * This method checks whether the IP can be parsed or not

func CompAddrInfo added in v1.1.0

func CompAddrInfo(pid string, maddrs []ma.Multiaddr) (peer.AddrInfo, error)

func CopyFileToNewPath

func CopyFileToNewPath(oldPath string, newPath string) error

func ExistsInArray

func ExistsInArray(inputList []string, inputValue string) bool

func ExistsInMapValue

func ExistsInMapValue(inputMap map[string]string, inputValue string) bool

func ExtractIPFromMAddr

func ExtractIPFromMAddr(maddr ma.Multiaddr) net.IP

func FilterClientType added in v1.1.0

func FilterClientType(userAgent string) (string, string)

Gets the client and version for a given userAgent. TODO: Perhaps use some regex

func FilterError added in v1.1.0

func FilterError(err string) string

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 GetForkDigestFromENode

func GetForkDigestFromENode(n enode.Node) (string, error)

func GetForkDigestFromEth2Data

func GetForkDigestFromEth2Data(b beacon.Eth2Data) string

func GetForkDigestFromStatus

func GetForkDigestFromStatus(b beacon.Status) string

func GetPublicAddrsFromAddrArray added in v1.1.0

func GetPublicAddrsFromAddrArray(mAddrs []ma.Multiaddr) ma.Multiaddr

func IsIPPublic

func IsIPPublic(ip net.IP) bool

func ParseInterfaceAddrArray

func ParseInterfaceAddrArray(input_arr []interface{}) ([]ma.Multiaddr, error)

func ParseInterfaceStringArray

func ParseInterfaceStringArray(input_arr []interface{}) []string

func ParseInterfaceTimeArray

func ParseInterfaceTimeArray(input_arr []interface{}) ([]time.Time, error)

func ParseLogFormatter

func ParseLogFormatter(lvl string) logrus.Formatter

parse Formatter from string

func ParseLogLevel

func ParseLogLevel(lvl string) logrus.Level

Select Log Level from string

func ParseLogOutput

func ParseLogOutput(lvl string) io.Writer

parse Formatter from string

func ParseNodeEth2Data

func ParseNodeEth2Data(n enode.Node) (data *beacon.Eth2Data, exists bool, err error)

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 ParsePubkey

func ParsePubkey(v string) (*ecdsa.PublicKey, error)

func PrivKeyToString

func PrivKeyToString(input_key *crypto.Secp256k1PrivateKey) string

Export Private Key to a string

func ReturnGreatestTime

func ReturnGreatestTime(input_array []time.Time) time.Time

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

func ReturnMaxInt(input_array []int) int

func UnmarshalMaddr

func UnmarshalMaddr(inputAddr string) (ma.Multiaddr, error)


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

func (Eth2ENREntry) Eth2Data

func (eee Eth2ENREntry) Eth2Data() (*beacon.Eth2Data, error)


Path Synopsis

Jump to

Keyboard shortcuts

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