utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: MIT Imports: 18 Imported by: 2

Documentation

Index

Constants

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

Variables

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

App default configurations

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

Functions

func CheckFileExists

func CheckFileExists(inputPath string) bool

func CheckValidIP

func CheckValidIP(input_IP string) bool

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

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(input_addr ma.Multiaddr) net.IP

func Generate_privKey

func Generate_privKey() string

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

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

func (Eth2ENREntry) Eth2Data

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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