Documentation ¶
Index ¶
- Constants
- Variables
- func CalcAppDataDir() string
- func ChownFileIfNeeded(path string)
- func ImportConfig(data []byte, directory string) error
- func IsDevVersion() bool
- func SystemInfoFromUserAgent(userAgent string) (goos string, goarch string)
- func VersionFromUserAgent(userAgent string) string
- type BlockedPeer
- type Config
- func (c *Config) DNSNamesMapping() map[string]string
- func (c *Config) DataDir() string
- func (c *Config) DevMode() bool
- func (c *Config) Export() []byte
- func (c *Config) GenUniqPeerAlias(name, alias string) string
- func (c *Config) GenerateNextIpAddr() string
- func (c *Config) GetBlockedPeer(peerID string) (BlockedPeer, bool)
- func (c *Config) GetBootstrapPeers() []peer.AddrInfo
- func (c *Config) GetListenAddresses() []multiaddr.Multiaddr
- func (c *Config) GetPeer(peerID string) (KnownPeer, bool)
- func (c *Config) IsUniqPeerAlias(excludePeerID, alias string) bool
- func (c *Config) KnownPeersIds() []peer.ID
- func (c *Config) LogLevel() zapcore.Level
- func (c *Config) PeerstoreDir() string
- func (c *Config) PrivKey() []byte
- func (c *Config) RemoveBlockedPeer(peerID string)
- func (c *Config) RemovePeer(peerID string) (KnownPeer, bool)
- func (c *Config) Save()
- func (c *Config) SetIdentity(key crypto.PrivKey, id peer.ID)
- func (c *Config) SetListenAddresses(multiaddrs []multiaddr.Multiaddr)
- func (c *Config) UpdatePeerLastSeen(peerID string)
- func (c *Config) UpsertBlockedPeer(peerID, displayName string)
- func (c *Config) UpsertPeer(peer KnownPeer)
- func (c *Config) VPNLocalIPMask() (net.IP, net.IPMask)
- type KnownPeer
- type P2pNodeConfig
- type UpdateConfig
- type VPNConfig
Constants ¶
View Source
const ( AppConfigFilename = "config_awl.json" AppDataDirectory = "anywherelan" DhtPeerstoreDataDirectory = "peerstore" AppDataDirEnvKey = "AWL_DATA_DIR" // TODO 8989 maybe? DefaultHTTPPort = 8639 AdminHttpServerDomainName = "admin" AdminHttpServerIP = "127.0.0.66" AdminHttpServerListenAddress = "127.0.0.66:80" DefaultPeerAlias = "peer" )
View Source
const DevVersion = "dev"
Variables ¶
View Source
var ( Version = DevVersion UserAgent = UserAgentPrefix + SystemInfo + "/" + Version UserAgentPrefix = "awl/" SystemInfo = runtime.GOOS + "-" + runtime.GOARCH )
View Source
var DefaultBootstrapPeers []multiaddr.Multiaddr
View Source
var LinuxFilesOwnerUID = os.Geteuid()
LinuxFilesOwnerUID is used to set correct files owner uid. This is needed because by default all files belong to root when we run as root, but they are stored in user's directory.
Functions ¶
func CalcAppDataDir ¶
func CalcAppDataDir() string
func ChownFileIfNeeded ¶ added in v0.9.0
func ChownFileIfNeeded(path string)
func ImportConfig ¶
func IsDevVersion ¶ added in v0.5.1
func IsDevVersion() bool
IsDevVersion Possible duplicate of *Config.DevMode() Based on build version (unchangeable after build, could be used only by developers)
func SystemInfoFromUserAgent ¶ added in v0.7.0
func VersionFromUserAgent ¶
Types ¶
type BlockedPeer ¶
type Config ¶
type Config struct { sync.RWMutex `swaggerignore:"true"` Version string `json:"version"` LoggerLevel string `json:"loggerLevel"` HttpListenAddress string `json:"httpListenAddress"` HttpListenOnAdminHost bool `json:"httpListenOnAdminHost"` P2pNode P2pNodeConfig `json:"p2pNode"` VPNConfig VPNConfig `json:"vpn"` KnownPeers map[string]KnownPeer `json:"knownPeers"` BlockedPeers map[string]BlockedPeer `json:"blockedPeers"` Update UpdateConfig `json:"update"` // contains filtered or unexported fields }
func (*Config) DNSNamesMapping ¶
func (*Config) DevMode ¶
DevMode Possible duplicate of IsDevVersion() Based on Config.LoggerLevel (could be used by any user)
func (*Config) GenUniqPeerAlias ¶ added in v0.5.1
func (*Config) GenerateNextIpAddr ¶
GenerateNextIpAddr is not thread safe.
func (*Config) GetBlockedPeer ¶
func (c *Config) GetBlockedPeer(peerID string) (BlockedPeer, bool)
func (*Config) GetBootstrapPeers ¶
func (*Config) GetListenAddresses ¶
func (c *Config) GetListenAddresses() []multiaddr.Multiaddr
func (*Config) IsUniqPeerAlias ¶ added in v0.5.1
func (*Config) KnownPeersIds ¶
func (*Config) PeerstoreDir ¶
func (*Config) RemoveBlockedPeer ¶
func (*Config) SetListenAddresses ¶
func (c *Config) SetListenAddresses(multiaddrs []multiaddr.Multiaddr)
func (*Config) UpdatePeerLastSeen ¶
func (*Config) UpsertBlockedPeer ¶
func (*Config) UpsertPeer ¶
type KnownPeer ¶
type KnownPeer struct { // Hex-encoded multihash representing a peer ID PeerID string `json:"peerId"` // Peer provided name Name string `json:"name"` // User provided name Alias string `json:"alias"` // IPAddr used for forwarding IPAddr string `json:"ipAddr"` // DomainName without zone suffix (.awl) DomainName string `json:"domainName"` // Time of adding to config (accept/invite) CreatedAt time.Time `json:"createdAt"` // Time of last connection LastSeen time.Time `json:"lastSeen"` // Has remote peer confirmed our invitation Confirmed bool `json:"confirmed"` // Has remote peer declined our invitation Declined bool `json:"declined"` WeAllowUsingAsExitNode bool `json:"weAllowUsingAsExitNode"` AllowedUsingAsExitNode bool `json:"allowedUsingAsExitNode"` }
func (KnownPeer) DisplayName ¶
type P2pNodeConfig ¶
type P2pNodeConfig struct { // Hex-encoded multihash representing a peer ID, calculated from Identity PeerID string `json:"peerId"` Name string `json:"name"` Identity string `json:"identity"` BootstrapPeers []string `json:"bootstrapPeers"` ListenAddresses []string `json:"listenAddresses"` ReconnectionIntervalSec time.Duration `json:"reconnectionIntervalSec" swaggertype:"primitive,integer"` AutoAcceptAuthRequests bool `json:"autoAcceptAuthRequests"` }
type UpdateConfig ¶
Click to show internal directories.
Click to hide internal directories.