Documentation
¶
Index ¶
- Constants
- func Copy(dst, src string) error
- func GenerateServiceKeyPairs() map[string]ServiceConfig
- func Input(def string, args ...interface{}) string
- func InputYN(def bool, args ...interface{}) bool
- func Inputf(def string, f string, args ...interface{}) string
- func InteractiveConfig(suite network.Suite, binaryName string)
- func RunServer(configFilename string)
- func TildeToHome(path string) string
- type CertificateURL
- type CertificateURLType
- type CothorityConfig
- type Group
- type GroupToml
- type ServerServiceConfig
- type ServerToml
- type ServiceConfig
Constants ¶
const ( // String is a CertificateURL type containing a certificate. String CertificateURLType = "string" // File is a CertificateURL type that contains the path to a file // containing a certificate. File = "file" // InvalidCertificateURLType is an invalid CertificateURL type. InvalidCertificateURLType = "wrong" // DefaultCertificateURLType is the default type when no type is specified DefaultCertificateURLType = File )
const DefaultAddress = "127.0.0.1"
DefaultAddress where to be contacted by other servers.
const DefaultGroupFile = "public.toml"
DefaultGroupFile is the default group definition file-name.
const DefaultPort = 7770
DefaultPort to listen and connect to. As of this writing, this port is not listed in /etc/services
const DefaultServerConfig = "private.toml"
DefaultServerConfig is the default server configuration file-name.
Variables ¶
This section is empty.
Functions ¶
func GenerateServiceKeyPairs ¶
func GenerateServiceKeyPairs() map[string]ServiceConfig
GenerateServiceKeyPairs generates a map of the service with their key pairs. It can be used to generate server configuration.
func Input ¶
Input prints the arguments given with an 'input'-format and proposes the 'def' string as default. If the user presses 'enter', the 'dev' will be returned. In the case of an error it will Fatal.
func InputYN ¶
InputYN asks a Yes/No question. Anything else than upper/lower-case 'y' will be interpreted as no.
func InteractiveConfig ¶
InteractiveConfig uses stdin to get the [address:]PORT of the server. If no address is given, portscan is used to find the public IP. In case no public IP can be configured, localhost will be used. If everything is OK, the configuration-files will be written. In case of an error this method Fatals.
func RunServer ¶
func RunServer(configFilename string)
RunServer starts a conode with the given config file name. It can be used by different apps (like CoSi, for example)
func TildeToHome ¶
TildeToHome takes a path and replaces an eventual "~" with the home-directory. If the user-directory is not defined it will return a path relative to the root-directory "/".
Types ¶
type CertificateURL ¶
type CertificateURL string
CertificateURL contains the CertificateURLType and the actual URL certificate, which can be a path leading to a file containing a certificate or a string directly being a certificate.
func (CertificateURL) CertificateURLType ¶
func (cu CertificateURL) CertificateURLType() CertificateURLType
CertificateURLType returns the CertificateURL type from the CertificateURL. It returns InvalidCertificateURLType if the CertificateURL is not valid or if the CertificateURL type is not known.
func (CertificateURL) Content ¶
func (cu CertificateURL) Content() ([]byte, error)
Content returns the bytes representing the certificate.
func (CertificateURL) String ¶
func (cu CertificateURL) String() string
String returns the CertificateURL as a string.
func (CertificateURL) Valid ¶
func (cu CertificateURL) Valid() bool
Valid returns true if the CertificateURL is well formed or false otherwise.
type CertificateURLType ¶
type CertificateURLType string
CertificateURLType represents the type of a CertificateURL. The supported types are defined as constants of type CertificateURLType.
type CothorityConfig ¶
type CothorityConfig struct { Suite string Public string Services map[string]ServiceConfig Private string Address network.Address ListenAddress string Description string URL string WebSocketTLSCertificate CertificateURL WebSocketTLSCertificateKey CertificateURL }
CothorityConfig is the configuration structure of the cothority daemon. - Suite: The cryptographic suite - Public: The public key - Private: The Private key - Address: The external address of the conode, used by others to connect to this one - ListenAddress: The address this conode is listening on - Description: The description - URL: The URL where this server can be contacted externally. - WebSocketTLSCertificate: TLS certificate for the WebSocket - WebSocketTLSCertificateKey: TLS certificate key for the WebSocket
func LoadCothority ¶
func LoadCothority(file string) (*CothorityConfig, error)
LoadCothority loads a conode config from the given file.
func ParseCothority ¶
func ParseCothority(file string) (*CothorityConfig, *onet.Server, error)
ParseCothority parses the config file into a CothorityConfig. It returns the CothorityConfig, the Host so we can already use it, and an error if the file is inaccessible or has wrong values in it.
func (*CothorityConfig) GetServerIdentity ¶
func (hc *CothorityConfig) GetServerIdentity() (*network.ServerIdentity, error)
GetServerIdentity will convert a CothorityConfig into a *network.ServerIdentity. It can give an error if there is a problem parsing the strings from the CothorityConfig.
func (*CothorityConfig) Save ¶
func (hc *CothorityConfig) Save(file string) error
Save will save this CothorityConfig to the given file name. It will return an error if the file couldn't be created or if there is an error in the encoding.
type Group ¶
type Group struct { Roster *onet.Roster Description map[*network.ServerIdentity]string }
Group holds the Roster and the server-description.
func ReadGroupDescToml ¶
ReadGroupDescToml reads a group.toml file and returns the list of ServerIdentities and descriptions in the file. If the file couldn't be decoded or doesn't hold valid ServerIdentities, an error is returned.
func (*Group) GetDescription ¶
func (g *Group) GetDescription(e *network.ServerIdentity) string
GetDescription returns the description of a ServerIdentity.
type GroupToml ¶
type GroupToml struct {
Servers []*ServerToml `toml:"servers"`
}
GroupToml holds the data of the group.toml file.
func NewGroupToml ¶
func NewGroupToml(servers ...*ServerToml) *GroupToml
NewGroupToml creates a new GroupToml struct from the given ServerTomls. Currently used together with calling String() on the GroupToml to output a snippet which can be used to create a Cothority.
type ServerServiceConfig ¶
ServerServiceConfig is a public configuration for a server (i.e. private key is missing)
type ServerToml ¶
type ServerToml struct { Address network.Address Suite string Public string Description string Services map[string]ServerServiceConfig URL string `toml:"URL,omitempty"` }
ServerToml is one entry in the group.toml file describing one server to use for the cothority.
func NewServerToml ¶
func NewServerToml(suite network.Suite, public kyber.Point, addr network.Address, desc string, services map[string]ServiceConfig) *ServerToml
NewServerToml takes a public key and an address and returns the corresponding ServerToml. If an error occurs, it will be printed to StdErr and nil is returned.
func (*ServerToml) String ¶
func (s *ServerToml) String() string
String returns the TOML representation of the ServerToml.
func (*ServerToml) ToServerIdentity ¶
func (s *ServerToml) ToServerIdentity() (*network.ServerIdentity, error)
ToServerIdentity converts this ServerToml struct to a ServerIdentity.
type ServiceConfig ¶
ServiceConfig is the configuration of a specific service to override default parameters as the key pair