config

package
v0.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 Arch

func Arch() string

Arch returns the current architecture.

func HostName

func HostName() (string, error)

HostName returns the hostname of the current machine.

func ID

func ID() (string, error)

ID returns the device ID.

func Init

func Init(options ...Option) error

Init initializes the device package.

func IsAndroid

func IsAndroid() bool

IsAndroid returns true if the current platform is android.

func IsDesktop

func IsDesktop() bool

IsDesktop returns true if the current platform is ANY desktop platform.

func IsIOS

func IsIOS() bool

IsIOS returns true if the current platform is iOS.

func IsLinux

func IsLinux() bool

IsLinux returns true if the current platform is linux.

func IsMacOS

func IsMacOS() bool

IsMacOS returns true if the current platform is macOS.

func IsMobile

func IsMobile() bool

IsMobile returns true if the current platform is ANY mobile platform.

func IsWindows

func IsWindows() bool

IsWindows returns true if the current platform is windows.

func NewDefaultLocation

func NewDefaultLocation() *t.Location

NewDefaultLocation returns the Sonr HQ as default location

func NewDefaultProfile

func NewDefaultProfile(options ...DefaultProfileOption) *t.Profile

NewDefaultProfile creates a new default Profile

func Platform

func Platform() string

Platform returns formatted GOOS for Text format. Returns: ["MacOS", "Windows", "Linux", "Android", "iOS"]

func Stat

func Stat() (map[string]string, error)

Stat returns the device stat.

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 Option

type Option func(o *options)

func SetDeviceID

func SetDeviceID(id string) Option

SetDeviceID sets the device ID

func WithHomePath

func WithHomePath(p string) Option

WithHomePath sets the Home Directory

func WithSupportPath

func WithSupportPath(p string) Option

WithSupportPath sets the Support Directory

func WithTempPath

func WithTempPath(p string) Option

WithTempPath sets the Temporary Directory

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL