Documentation
¶
Overview ¶
Copyright 2020 Multi-Tier-Cloud Development Team * * 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 2020 Multi-Tier-Cloud Development Team * * 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 2020 Multi-Tier-Cloud Development Team * * 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 ¶
- Constants
- func AddBootstrapFlags() (*[]multiaddr.Multiaddr, error)
- func CreateOrLoadKey(kf KeyFlags) (crypto.PrivKey, error)
- func ExpandTilde(path string) (string, error)
- func FileExists(filePath string) bool
- func GeneratePrivKey(algo string, bits int) (crypto.PrivKey, error)
- func GetBootstrapPointer() *bootstrapAddrs
- func GetFreePort() (int, error)
- func GetIPAddress() (string, error)
- func LoadPrivKeyFromFile(keyFile string) (crypto.PrivKey, error)
- func StorePrivKeyToFile(priv crypto.PrivKey, keyFile string) error
- type KeyFlags
Constants ¶
const (
RSA_MIN_BITS = 2048
)
Variables ¶
This section is empty.
Functions ¶
func AddBootstrapFlags ¶
func AddBootstrapFlags() (*[]multiaddr.Multiaddr, error)
Returns address to a slice of strings that will store the bootstrap multiaddresses once flag.Parse() is called (prior to that, it will be an empty slice).
func ExpandTilde ¶
Expands tilde to absolute path Currently only works if path begins with tilde, not somewhere in the middle
func FileExists ¶
func GetBootstrapPointer ¶
func GetBootstrapPointer() *bootstrapAddrs
Don't like this... feels hacky to have a function just for tests in the main package This is needed to return a pointer to type bootstrapAddrs, a hidden type. This enables tests for the Set() and String() functions above.
func LoadPrivKeyFromFile ¶
Inverse of storePrivKeyToFile()
Types ¶
type KeyFlags ¶
func AddKeyFlags ¶
Adds CLI arguments for key-related flags. Does not call Parse() on its own.
Takes a single parameter, the default key filename. This allows programs to define different default key filenames, so that if two different programs are run on the same host, they won't read from the same key.
Returns a struct containing pointers to the various variables that will hold the parsed flag values once Parse() is called.