Documentation
¶
Index ¶
- func CreateClientFromConfig(ConfigFile []string) (*router.Client, error)
- func CreateClientFromNetConfig(ClientConfig *ClientConfig) (*router.Client, error)
- func CreateListenerFromConfig(ConfigFile []string, ListenChannel string) (*router.Listener, error)
- func CreateListenerFromNetConfig(ClientConfig *ClientConfig, ListenChannel string) (*router.Listener, error)
- func CreateOrLoadKeyStore(tokenFile string) (*keystore.KeyStore, error)
- func LoadClientTLSConfig(ConfigFile []string) (string, *tls.Config, error)
- func LoadRouterTLSConfig(config *ClientConfig) (*tls.Config, error)
- type ClientConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateClientFromConfig ¶
CreateClientFromConfig creates a client from `ConfigFile`.
func CreateClientFromNetConfig ¶ added in v0.0.22
func CreateClientFromNetConfig(ClientConfig *ClientConfig) (*router.Client, error)
CreateClientFromNetConfig creates a client from `ClientConfig`.
func CreateListenerFromConfig ¶
CreateListenerFromConfig creates a listener on `ListenChannel` from `ConfigFile`.
func CreateListenerFromNetConfig ¶ added in v0.0.22
func CreateListenerFromNetConfig(ClientConfig *ClientConfig, ListenChannel string) (*router.Listener, error)
CreateListenerFromNetConfig creates a listener on `ListenChannel` from `ClientConfig`.
func CreateOrLoadKeyStore ¶
CreateOrLoadKeyStore loads a KeyStore from `tokenFile`. If this file does not exist, a new config will be generated. If `tokenFile` is empty, a (nil, nil) will be returned indicating no permission check will be performed.
func LoadClientTLSConfig ¶
LoadClientTLSConfig returns only the RouterAddress and TLSConfig part from `ConfigFile`.
func LoadRouterTLSConfig ¶
func LoadRouterTLSConfig(config *ClientConfig) (*tls.Config, error)
LoadRouterTLSConfig returns the tls config used by a router. If `EnableTLS` is false, a nil will be returned.
Types ¶
type ClientConfig ¶
type ClientConfig struct { // RouterAddress is the network address of the Router. RouterAddress string `json:"router-address"` // EnableTLS -- If true, `CaCert`, `ClientCert` and `ClientKey` will be used to communicate with the Router. Must be the same to the router. EnableTLS bool `json:"tls"` // CaCert stores the filename to load a PEM CA cert. Used for server authentication. CaCert string `json:"ca-file"` // ServerNameOverride overrides the server name used for the client to authenticate the Router if not empty. ServerNameOverride string `json:"server-name"` // CertFile stores the filename to the client's cert file in PEM format, used for providing an identity to the server. CertFile string `json:"cert-file"` // KeyFile stores the filename to the client's key file in PEM format. KeyFile string `json:"key-file"` // TokenFile provides the Router extra ACL control in application layer. TokenFile string `json:"token-file"` }
ClientConfig stores the configuration to connect to the Router network.
func LoadNetConfig ¶ added in v0.0.15
func LoadNetConfig(ConfigFile []string) (*ClientConfig, error)
LoadNetConfig loads client configuration from `ConfigFile`, returns any error encountered.