Documentation ¶
Overview ¶
Copyright 2022 Nethermind
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Nethermind ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func AssignPorts(host string, defaults map[string]uint16) (ports map[string]uint16, err error)
- func CheckContainers(cmdRunner commands.CommandRunner, generationPath string) (string, error)
- func CheckErr(descr string, isErr bool, err error) error
- func CheckUrlOrPath(src string) error
- func Contains(list []string, str string) bool
- func ContainsOnly(list []string, target []string) bool
- func CopyFile(src, dst string) error
- func CurrentVersion() string
- func DownloadOrCopy(src, dest string, autoremove bool) error
- func ENRValidator(bootNodes []string) error
- func ENodesValidator(bootNodes []string) error
- func Filter[T any](list []T, filter func(T) bool) (ret []T)
- func GetDistroName() (_ string, err error)
- func GetRequest(url string, retryDuration time.Duration) (*http.Response, error)
- func GetUrlOrPathContent(src string) (string, error)
- func HandleUrlOrPath(src string, handleUrl func(url string) error, ...) error
- func IsAddress(a string) bool
- func IsLatestVersion() (bool, error)
- func LoadDockerComposeServices(path string) ([]string, error)
- func ParseEnv(path string) (map[string]string, error)
- func SetUmask(mask int)
- func SkipLines(content string, symbol string) string
- func SupportedNetworks() (networkNames []string, err error)
- func UriValidator(input []string) (string, bool)
- func ValidateCompose(path string) error
- func ZipString(lists ...[]string) ([][]string, error)
- type DepositCLI
- type DistroInfo
- type ValidatorKeyData
Constants ¶
This section is empty.
Variables ¶
var ( ErrorNoTag = errors.New("no tag found on Github") ErrorCheckingVersion = errors.New("error while checking for new Version, please check your internet connection") )
var Version string
Version represents the current version of Sedge
Functions ¶
func AssignPorts ¶ added in v0.6.0
AssignPorts : Checks if port is occupied in a given host
params :- a. host string Host which port is to be checked b. port string Port to be checked
returns :- a. bool True if <port> is available. False otherwise
func CheckContainers ¶
func CheckContainers(cmdRunner commands.CommandRunner, generationPath string) (string, error)
CheckContainers : Check if containers of generated docker-compose script are running
params :- a. generationPath string Path to the generated docker-compose script
returns :- a. string Output of 'docker ps --services --filter status=running' b. error Error if any
func CheckErr ¶
CheckErr : Helper function for tests. Check if a given error was expected.
params :- a. desc string Description of the error in case of failure b. isError bool Whether the error was expected or not c. err error Error to check
returns :- a. error Error if any
func CheckUrlOrPath ¶ added in v1.0.0
CheckUrlOrPath : Verifies if provided source string is an url or filepath returning relevant error if neither
params :- a. string Source that will be tried to convert to url or path
returns :- a. error if provided source is neither file or url.
func Contains ¶
Contains : Checks if a string slice contains a string
params :- a. list []string String slice to be checked b. str string String to be checked
returns :- a. bool True if str is in list, false otherwise
func ContainsOnly ¶
ContainsOnly : Checks if a string slice contains only strings of a given string slice
params :- a. list []string String slice to be checked b. target []string String slice to be checked
returns :- a. bool True if every string in list is in target, false otherwise
func CopyFile ¶ added in v1.0.0
CopyFile: Copies the file from src to dst, if the directory of the dst doesn't exist then is created before the copy.
params :- a. src string Source path b. dst string Destination path
func CurrentVersion ¶ added in v0.4.0
func CurrentVersion() string
CurrentVersion : Export the current version of Sedge
params :- None
returns :- a. string Return the current version of Sedge
func DownloadOrCopy ¶ added in v1.0.0
DownloadOrCopy : Get content of the source url or filepath provided
params :- a. string Source that will be used as url or filepath b. string Destination filepath to downloaded or copied file c. bool Delete existing file in the destination filepath
returns :- a. error if any
func ENRValidator ¶ added in v1.0.0
ENRValidator validates a list of CL boot nodes and returns an error if any of them is invalid.
func ENodesValidator ¶ added in v1.0.0
ENodesValidator validates a list of EL boot nodes and returns an error if any of them is invalid.
func Filter ¶ added in v0.3.0
Filter : Filter a slice given a predicate
params :- a. list []K List to be filtered b. filter func(K) bool Predicate to be applied to each element of the list
returns :- a. []K Filtered list
func GetDistroName ¶
GetDistroName : Get the name and version of the linux distribution of the host machine.
params :- None
returns :- a. string "<Distribution_Name> <Distribution_Version>" a. error Error if any
func GetRequest ¶ added in v1.0.0
GetRequest : Make a GET request to the given URL. Uses exponential retries with backoff.
params :- a. url string URL to make the request to b. retryDuration time.Duration Duration to wait between retries
returns :- a. http.Response Response from the request b. error Error if any
func GetUrlOrPathContent ¶ added in v1.0.0
GetUrlOrPathContent : Get content of the source url or filepath provided
params :- a. string Source that will be used as url or filepath
returns :- a. error if any
func HandleUrlOrPath ¶ added in v1.0.0
func HandleUrlOrPath( src string, handleUrl func(url string) error, handlePath func(path string) error, ) error
HandleUrlOrPath : Get a source string and call related handler if the source
params :- a. string Source that will be tried to convert to url or path b. func(url string) error Handler function to call if source is an url c. func(path string) error Handler function to call if source is a filepath
returns :- a. error occurred during any of the handlers if any or if provided source is neither file or url.
func IsAddress ¶
IsAddress : Checks if a string is an Ethereum address
params :- a. a string String to be checked
returns :- a. bool True if <a> is a valid Ethereum address. False otherwise
func IsLatestVersion ¶ added in v0.4.0
IsLatestVersion : Check if we are running the latest version that was released on GitHub
params :- None
returns :- a. bool Returns true if we are on the latest version, but false if we have a different version that latest on Github. a. err error Error if any
func LoadDockerComposeServices ¶ added in v1.0.0
TODO: Add unit tests LoadDockerComposeServices get the services from a Sedge valid docker-compose script
func ParseEnv ¶ added in v1.0.0
ParseEnv parse a .env file and return a map of the environment variables
func SkipLines ¶
SkipLines : Skips lines starting with `symbol`
params :- a. content string String to be processed b. symbol string Symbol to be skipped
returns :- a. string Processed string
func SupportedNetworks ¶
SupportedNetworks : Get supported networks names. A network is supported if it has a folder with the network name in either templates/envs or templates/services forder.
params :- none
returns :- a. []string List of supported network names b. error Error if any
func UriValidator ¶ added in v1.0.0
UriValidator validates a URI and returns true if it is valid.
func ValidateCompose ¶ added in v1.0.0
ValidateCompose validate a docker-compose script according to the docker-compose specification
Types ¶
type DepositCLI ¶
type DepositCLI struct { // Network : Network name, e.g. "mainnet", "sepolia" Network string // Path : Path to the keystore folder Path string // Password : Keystore password Password string // LenPass : Slice used to hide password in template LenPass []struct{} // Image : staking-deposit-cli docker image Image string // Eth1WithdrawalAddress : Address to be used to create withdrawal credentials Eth1WithdrawalAddress string }
DepositCLI : Struct Data for eth2.0-deposit-cli command template
type DistroInfo ¶
DistroInfo : Struct Contains name, architecture and version of the linux distribution of the host machine
type ValidatorKeyData ¶
type ValidatorKeyData struct { // Existing: True if a existing mnemonic is being used. False to create and use a new one. Existing bool // Network : Target network Network string // Path : Path to the keystore folder Path string // Password : Keystore password Password string // Eth1WithdrawalAddress : Address to be used to create withdrawal credentials Eth1WithdrawalAddress string }
ValidatorKeyData : Struct Data for Keystore generation