Documentation
¶
Overview ¶
Package network provides LAN discovery (mDNS) and PIN-based credential exchange for sync setup.
Index ¶
Constants ¶
View Source
const DingovaultService = "_dingovault._tcp"
DingovaultService is the mDNS DNS-SD service name for peer discovery.
Variables ¶
This section is empty.
Functions ¶
func StartPINAdvertiser ¶
func StartPINAdvertiser(ctx context.Context, instance string, pairingPort int, cred PairingCredentials) (pin string, stop func(), err error)
StartPINAdvertiser listens for pairing connections, publishes mDNS, and returns a 4-digit PIN. stop closes the listener and mDNS server; it is safe to call more than once.
Types ¶
type PairingCredentials ¶
type PairingCredentials struct {
WebDAVURL string `json:"webdavUrl"`
WebDAVUser string `json:"webdavUser"`
WebDAVPassword string `json:"webdavPassword"`
WebDAVRemoteRoot string `json:"webdavRemoteRoot,omitempty"`
S3Region string `json:"s3Region,omitempty"`
S3Bucket string `json:"s3Bucket,omitempty"`
S3Prefix string `json:"s3Prefix,omitempty"`
S3AccessKey string `json:"s3AccessKey,omitempty"`
S3SecretKey string `json:"s3SecretKey,omitempty"`
S3Endpoint string `json:"s3Endpoint,omitempty"`
}
PairingCredentials is exchanged after a successful PIN check (plaintext on LAN — use only on trusted networks).
func PairWithPeer ¶
func PairWithPeer(ctx context.Context, host string, port int, pin string) (PairingCredentials, error)
PairWithPeer connects to a discovered host, sends the PIN, and decodes sync credentials (WebDAV and optional S3).
Click to show internal directories.
Click to hide internal directories.