Documentation
¶
Index ¶
- Variables
- func Arch() string
- func Exists(fileName string) bool
- func HostName() (string, error)
- func ID() (string, error)
- func Init(options ...Option) error
- func IsAndroid() bool
- func IsDesktop() bool
- func IsFile(fileName string) bool
- func IsIOS() bool
- func IsLinux() bool
- func IsMacOS() bool
- func IsMobile() bool
- func IsWindows() bool
- func LoadAcceptableCredentials() (map[string][]string, error)
- func LoadConditions() (map[int]string, map[int]int, map[int]string, error)
- func LoadCredentialStructure() (map[string]interface{}, error)
- func LoadKeyDirFromConfig() string
- func LoadPseudonymsysCAPubKey() *pseudsys.PubKey
- func LoadPseudonymsysCASecret() *big.Int
- func LoadPseudonymsysOrgPubKeys(orgName string) *pseudsys.PubKey
- func LoadPseudonymsysOrgPubKeysEC(orgName string) *ecpseudsys.PubKey
- func LoadPseudonymsysOrgSecrets(orgName, dlogType string) *pseudsys.SecKey
- func LoadQRRSA() *qr.RSA
- func LoadRegistrationDBAddress() string
- func LoadSchnorrGroup() *schnorr.Group
- func LoadServerEndpoint() string
- func LoadServerPort() int
- func LoadServiceInfo() (string, string, string)
- func LoadSessionKeyMinByteLen() int
- func LoadTestKeyDirFromConfig() string
- func LoadTestdataDir() string
- func LoadTimeout() int
- func NewDefaultLocation() *t.Location
- func NewDefaultProfile(options ...DefaultProfileOption) *t.Profile
- func Platform() string
- func Stat() (map[string]string, error)
- type CallbackImpl
- type Configuration
- type DefaultProfileOption
- type FilePathOptFunc
- type FilePathOption
- type Folder
- func (f Folder) Create(fileName string) (*os.File, error)
- func (f Folder) CreateFolder(dirName string) (Folder, error)
- func (f Folder) Delete(fileName string) error
- func (f Folder) Exists(fileName string) bool
- func (f Folder) GenPath(path string, opts ...FilePathOption) (string, error)
- func (f Folder) JoinPath(ps ...string) string
- func (f Folder) MkdirAll() error
- func (f Folder) Path() string
- func (f Folder) ReadFile(fileName string) ([]byte, error)
- func (f Folder) WriteFile(fileName string, data []byte) error
- type Option
- type Role
- type SonrConfig
Constants ¶
This section is empty.
Variables ¶
var ( // Path Manipulation Errors ErrDuplicateFilePathOption = errors.New("Duplicate file path option") ErrPrefixSuffixSetWithReplace = errors.New("Prefix or Suffix set with Replace.") ErrSeparatorLength = errors.New("Separator length must be 1.") ErrNoFileNameSet = errors.New("File name was not set by options.") // Device ID Errors ErrEmptyDeviceID = errors.New("Device ID cannot be empty") ErrMissingEnvVar = errors.New("Cannot set EnvVariable with empty value") // Directory errors ErrDirectoryInvalid = errors.New("Directory Type is invalid") ErrDirectoryUnset = errors.New("Directory path has not been set") ErrDirectoryJoin = errors.New("Failed to join directory path") // Node Errors ErrEmptyQueue = errors.New("No items in Transfer Queue.") ErrInvalidQuery = errors.New("No SName or PeerID provided.") ErrMissingParam = errors.New("Paramater is missing.") ErrProtocolsNotSet = errors.New("Node Protocol has not been initialized.") ErrRoutingNotSet = errors.New("DHT and Host have not been set by Routing Function") ErrListenerRequired = errors.New("Listener was not Provided") ErrMDNSInvalidConn = errors.New("Invalid Connection, cannot begin MDNS Service") // Default P2P Properties BootstrapAddrStrs = []string{ "/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN", "/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa", "/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb", "/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt", "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", "/ip4/104.131.131.82/udp/4001/quic/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", } AddrStoreTTL = time.Minute * 5 )
Functions ¶
func IsDesktop ¶
func IsDesktop() bool
IsDesktop returns true if the current platform is ANY desktop platform.
func IsMobile ¶
func IsMobile() bool
IsMobile returns true if the current platform is ANY mobile platform.
func LoadCredentialStructure ¶
func LoadKeyDirFromConfig ¶
func LoadKeyDirFromConfig() string
func LoadPseudonymsysOrgPubKeysEC ¶
func LoadPseudonymsysOrgPubKeysEC(orgName string) *ecpseudsys.PubKey
func LoadRegistrationDBAddress ¶
func LoadRegistrationDBAddress() string
func LoadSchnorrGroup ¶
func LoadServerEndpoint ¶
func LoadServerEndpoint() string
LoadServerEndpoint returns the endpoint of the emmy server where clients will be contacting it.
func LoadServerPort ¶
func LoadServerPort() int
LoadServerPort returns the port where emmy server will be listening.
func LoadServiceInfo ¶
func LoadSessionKeyMinByteLen ¶
func LoadSessionKeyMinByteLen() int
func LoadTestKeyDirFromConfig ¶
func LoadTestKeyDirFromConfig() string
func LoadTestdataDir ¶
func LoadTestdataDir() string
func LoadTimeout ¶
func LoadTimeout() int
LoadTimeout returns the specified number of seconds that clients wait before giving up on connection to emmy server
func NewDefaultLocation ¶
NewDefaultLocation returns the Sonr HQ as default location
func NewDefaultProfile ¶
func NewDefaultProfile(options ...DefaultProfileOption) *t.Profile
NewDefaultProfile creates a new default Profile
Types ¶
type CallbackImpl ¶
type CallbackImpl interface { // OnRefresh is called when the LobbyProtocol is refreshed and pushes a RefreshEvent OnRefresh(event *mv1.OnLobbyRefreshResponse) // OnMailbox is called when the MailboxProtocol receives a MailboxEvent OnMailbox(event *mv1.OnMailboxMessageResponse) // OnInvite is called when the TransferProtocol receives InviteEvent OnInvite(event *mv1.OnTransmitInviteResponse) // OnDecision is called when the TransferProtocol receives a DecisionEvent OnDecision(event *mv1.OnTransmitDecisionResponse, invite *mv1.OnTransmitInviteResponse) // OnProgress is called when the TransferProtocol sends or receives a ProgressEvent OnProgress(event *mv1.OnTransmitProgressResponse) // OnTransfer is called when the TransferProtocol completes a transfer and pushes a CompleteEvent OnComplete(event *mv1.OnTransmitCompleteResponse) }
CallbackImpl is the implementation of Callback interface
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
func DefaultConfiguration ¶
func DefaultConfiguration() *Configuration
type DefaultProfileOption ¶
type DefaultProfileOption func(profileOpts)
DefaultProfileOption is a type for Profile Options
func WithCheckerProfile ¶
func WithCheckerProfile(profile *t.Profile) DefaultProfileOption
WithCheckerProfile sets the checker profile
type FilePathOptFunc ¶
type FilePathOptFunc func(path string) FilePathOption
FilePathOptFunc is a function that returns a FilePathOption.
var WithPrefix FilePathOptFunc = func(path string) FilePathOption {
return &filePathOpt{
filePathOptType: filePathOptionTypePrefix,
value: path,
}
}
WithPrefix sets the prefix for the file path.
var WithReplace FilePathOptFunc = func(path string) FilePathOption {
return &filePathOpt{
filePathOptType: filePathOptionTypeReplace,
value: path,
}
}
WithReplace sets the replace string for the file path.
var WithSeparator FilePathOptFunc = func(path string) FilePathOption {
return &filePathOpt{
filePathOptType: filePathOptionTypeSeparator,
value: path,
}
}
WithSeparator sets the separator for the file path.
var WithSuffix FilePathOptFunc = func(path string) FilePathOption {
return &filePathOpt{
filePathOptType: filePathOptionTypeSuffix,
value: path,
}
}
WithSuffix sets the suffix for the file path.
type FilePathOption ¶
type FilePathOption interface {
Apply() *filePathOptions
}
FilePathOption is a function option for FilePath.
type Folder ¶
type Folder string
var ( // Determined/Provided Paths Home Folder // ApplicationDocumentsDir on Mobile, HOME_DIR on Desktop Support Folder // AppSupport Directory Temporary Folder // AppCache Directory // Calculated Paths Database Folder // Device DB Folder Downloads Folder // Temporary Directory on Mobile for Export, Downloads on Desktop Wallet Folder // Encrypted Storage Directory ThirdParty Folder // Sub-Directory of Support, used for Textile )
func (Folder) CreateFolder ¶
CreateFolder creates a folder.
func (Folder) GenPath ¶
func (f Folder) GenPath(path string, opts ...FilePathOption) (string, error)
GenPath generates a path from a folder and a file name.
type Option ¶
type Option func(o *options)
func WithSupportPath ¶
WithSupportPath sets the Support Directory
type Role ¶
type Role int
Role is the type of the node (Client, Highway)
type SonrConfig ¶
type SonrConfig struct { HighwayAddress string `json:"highway_address"` HighwayPort int `json:"highway_port"` HighwayNetwork string `json:"highway_network"` HighwayDID string `json:"highway_did"` IPFSPort int `json:"ipfs_port"` IPFSPath string `json:"ipfs_path"` LibP2PLowWater int `json:"libp2p_low_water"` LibP2PHighWater int `json:"libp2p_high_water"` LibP2PRendevouz string `json:"libp2p_rendevouz"` LibP2PBootstrapPeers []string `json:"libp2p_bootstrap_peers"` HomeDir string `json:"home_dir"` CacheDir string `json:"cache_dir"` ConfigDir string `json:"config_dir"` WalletDir string `json:"wallet_dir"` DeviceId string `json:"device_id"` PublicIP string `json:"public_ip"` PrivateIP string `json:"private_ip"` AccountName string `json:"account_name"` }
func (*SonrConfig) CacheFolder ¶
func (sc *SonrConfig) CacheFolder() Folder
Return the cache dir path as a Folder.
func (*SonrConfig) ConfigFolder ¶
func (sc *SonrConfig) ConfigFolder() Folder
Return the config dir path as a Folder.
func (*SonrConfig) HomeFolder ¶
func (sc *SonrConfig) HomeFolder() Folder
Return the home dir path as a Folder.
func (*SonrConfig) Save ¶
func (sc *SonrConfig) Save() (*SonrConfig, error)
func (*SonrConfig) WalletFolder ¶
func (sc *SonrConfig) WalletFolder() Folder
Create or return the wallet directory as a Folder.