Documentation
¶
Index ¶
- Constants
- Variables
- func AdvertiseService(hostname string, port int, realm, orgID string) (*zeroconf.Server, error)
- func AllZeros(b []byte) bool
- func Attach(session *xconn.Session, desktopName, orgID string) error
- func CallFileOp(deviceSession *xconn.Session, procedure string, payload []byte) ([]byte, error)
- func CfgDirectory() (string, error)
- func CloudURI() string
- func ConnectCloudRealm(cfgDirectory string) (*xconn.Session, error)
- func ConnectDeviceRealm(ctx context.Context, realm, cfgDirectory string, useP2P bool) (*xconn.Session, error)
- func ConnectWebrtc(ctx context.Context, session *xconn.Session, ...) (*xconn.Session, error)
- func CreateX25519KeyPair() (publicKey []byte, privateKey []byte, err error)
- func CredentialsFilePath() (string, error)
- func DecryptChaCha20Poly1305(ciphertext, nonce, key []byte) ([]byte, error)
- func DecryptPayload(data, key []byte) ([]byte, error)
- func DeriveKeyHKDF(sharedSecret, info []byte) ([]byte, error)
- func Detach(session *xconn.Session, authID string) error
- func DisablePrinting() error
- func EnablePrinterHosting() error
- func EnablePrinting() error
- func EncryptChaCha20Poly1305(plaintext, key []byte) ([]byte, []byte, error)
- func EncryptPayload(plaintext, key []byte) ([]byte, error)
- func FetchTURNServers(session *xconn.Session) ([]xconnwebrtc.ICEServer, int64, error)
- func ForwardLocalPort(ctx context.Context, session *xconn.Session, remotePort, localPort string) error
- func GetOrRefreshTURNServers(ctx context.Context, authid, privKey, cfgDirectory string) ([]xconnwebrtc.ICEServer, error)
- func Login(session *xconn.Session, username string) error
- func PerformKeyExchange(privateKey, peerPublicKey []byte) ([]byte, error)
- func ProxyFileOpHandler(clientSessions *ClientSessions, cfgDirectory string) xconn.InvocationHandler
- func ProxyProgressiveInvocationHandler(proxyCalls *ProxyCalls, clientSessions *ClientSessions, ...) xconn.InvocationHandler
- func ProxyShellHandler(proxyCalls *ProxyCalls, clientSessions *ClientSessions, cfgDirectory string) xconn.InvocationHandler
- func PullFiles(session *xconn.Session, remotePath, localPath string, recursive bool) error
- func PushFiles(session *xconn.Session, localPath, remotePath string, recursive bool) error
- func ReadCredentials(cfgDirectory string) (string, string, error)
- func RemoveCredentialsFiles(cfgDirectory string) error
- func SetPrintMode(mode PrintMode) error
- func StartInteractiveCommand(session *xconn.Session, realm, procedureName string, args ...string) error
- func WritePrincipalsToFile(principals []*CryptosignPrincipal) error
- type Authenticator
- func (a *Authenticator) Authenticate(request auth.Request) (auth.Response, error)
- func (a *Authenticator) Methods() []auth.Method
- func (a *Authenticator) RetrievePrincipal(authid string) (*CryptosignPrincipal, bool)
- func (a *Authenticator) SetPrincipal(authid string, principal *CryptosignPrincipal)
- func (a *Authenticator) SetPrincipals(principals []*CryptosignPrincipal)
- func (a *Authenticator) SubscribeEvents(session *xconn.Session, machineID string) error
- type ClientSessions
- func (c *ClientSessions) DeleteDeviceSession(realm string)
- func (c *ClientSessions) DeviceSessions() map[string]int64
- func (c *ClientSessions) EnsureDeviceSessionWithUpgrade(ctx context.Context, realm, cfgDirectory string) (*xconn.Session, <-chan *xconn.Session, error)
- func (c *ClientSessions) EnsureP2PDeviceSession(ctx context.Context, realm, cfgDirectory string) (*xconn.Session, error)
- func (c *ClientSessions) LoggedIn() bool
- func (c *ClientSessions) Login()
- func (c *ClientSessions) Logout()
- func (c *ClientSessions) SessionByRealm(authid string) (*xconn.Session, bool)
- func (c *ClientSessions) StoreDeviceSession(realm string, session *xconn.Session)
- type Config
- type Credentials
- type CryptosignPrincipal
- type Deskconn
- type Device
- type FileBrowseResult
- type FileBrowser
- type FileEntry
- type MPRIS
- func (m *MPRIS) ListPlayers() (map[string]string, error)
- func (m *MPRIS) Next() error
- func (m *MPRIS) NextPlayer(name string) error
- func (m *MPRIS) Pause() error
- func (m *MPRIS) PausePlayer(name string) error
- func (m *MPRIS) Play() error
- func (m *MPRIS) PlayPause() error
- func (m *MPRIS) PlayPausePlayer(name string) error
- func (m *MPRIS) PlayPlayer(name string) error
- func (m *MPRIS) Previous() error
- func (m *MPRIS) PreviousPlayer(name string) error
- type Organization
- type PrintJobStatus
- type PrintMode
- type Printer
- type PrinterInfo
- type PrintingConfig
- type ProxyCall
- type ProxyCalls
- type Screen
- type TURNCredentials
Constants ¶
const ( Realm = "io.xconn.deskconn" ProcedureDeskconnAttachDesktop = "io.xconn.deskconn.desktop.attach" ProcedureDeskconnDetachDesktop = "io.xconn.deskconn.desktop.detach" ProcedureDeskconnOrganizationList = "io.xconn.deskconn.organization.list" ProcedureOrganizationCreate = "io.xconn.deskconn.organization.create" TopicDeskconnDesktopDetachFormat = "io.xconn.deskconn.desktop.%s.detach" MachineIDPath = "/etc/machine-id" )
const ( ProcedureListKeys = "io.xconn.deskconn.desktop.access.key.list" TopicKeyAddedFormat = "io.xconn.deskconn.desktop.%s.key.add" TopicKeyRemovedFormat = "io.xconn.deskconn.desktop.%s.key.remove" )
const ( ProcedureKeyExchange = "io.xconn.deskconn.deskconnd.key.exchange" ProcedureScreenBrightnessGet = "io.xconn.deskconn.deskconnd.screen.brightness.get" ProcedureScreenBrightnessSet = "io.xconn.deskconn.deskconnd.screen.brightness.set" ProcedureScreenLock = "io.xconn.deskconn.deskconnd.screen.lock" ProcedureScreenIsLocked = "io.xconn.deskconn.deskconnd.screen.islocked" ProcedureShell = "io.xconn.deskconn.deskconnd.shell" ProcedureExec = "io.xconn.deskconn.deskconnd.exec" ProcedureFileBrowse = "io.xconn.deskconn.deskconnd.file.browse" ProcedurePrinterList = "io.xconn.deskconn.deskconnd.printer.list" ProcedurePrinterPrint = "io.xconn.deskconn.deskconnd.printer.print" ProcedureFileRename = "io.xconn.deskconn.deskconnd.file.rename" ProcedureFileDelete = "io.xconn.deskconn.deskconnd.file.delete" ProcedureFileCopy = "io.xconn.deskconn.deskconnd.file.copy" ProcedureMPRISPlayers = "io.xconn.deskconn.deskconnd.mpris.players" ProcedureMPRISPlayPause = "io.xconn.deskconn.deskconnd.mpris.playpause" ProcedureMPRISPlay = "io.xconn.deskconn.deskconnd.mpris.play" ProcedureMPRISPause = "io.xconn.deskconn.deskconnd.mpris.pause" ProcedureMPRISNext = "io.xconn.deskconn.deskconnd.mpris.next" ProcedureMPRISPrevious = "io.xconn.deskconn.deskconnd.mpris.previous" ErrInvalidArgument = "wamp.error.invalid_argument" ErrOperationFailed = "wamp.error.operation_failed" MetaTopicSessionLeave = "wamp.session.on_leave" )
const ( ProcedureWebRTCOffer = "io.xconn.webrtc.offer" TopicAnswererOnCandidate = "io.xconn.webrtc.answerer.on_candidate" TopicOffererOnCandidate = "io.xconn.webrtc.offerer.on_candidate" ProcedurePrincipalCreate = "io.xconn.deskconn.account.principal.create" ProcedurePrincipalDelete = "io.xconn.deskconn.account.principal.delete" ProcedureAccountGet = "io.xconn.deskconn.account.get" ProcedureProxyShell = "io.xconn.deskconn.deskconnd.proxy.shell" ProcedureProxyExec = "io.xconn.deskconn.deskconnd.proxy.exec" ProcedureProxyFileOp = "io.xconn.deskconn.deskconnd.proxy.file.op" ProcedureLogin = "io.xconn.deskconn.login" ProcedureLogout = "io.xconn.deskconn.logout" ProcedureConnectedDevices = "io.xconn.deskconn.connected_devices" ProcedureListDesktop = "io.xconn.deskconn.desktop.list" ProcedureAppUpdateCheck = "io.xconn.deskconn.app.update.check" ProcedureCoturnCreate = "io.xconn.deskconn.coturn.credentials.create" LocalRealm = "io.xconn.deskconn.local" CloudRealm = "io.xconn.deskconn" ErrAuthenticationFailed = "wamp.error.authentication_failed" StunServerURL = "stun:stun.l.google.com:19302" )
const (
ProcedureFileDownload = "io.xconn.deskconn.deskconnd.file.download"
)
const (
ProcedureFileUpload = "io.xconn.deskconn.deskconnd.file.upload"
)
const (
ProcedurePortForward = "io.xconn.deskconn.deskconnd.port.forward"
)
Variables ¶
var BacklightBasePath = "/sys/class/backlight" //nolint: gochecknoglobals
Functions ¶
func AdvertiseService ¶
func CallFileOp ¶
func CfgDirectory ¶
func ConnectDeviceRealm ¶
func ConnectWebrtc ¶
func CreateX25519KeyPair ¶
func CredentialsFilePath ¶
func DecryptChaCha20Poly1305 ¶
func DecryptPayload ¶
DecryptPayload decrypts a payload produced by EncryptPayload (nonce+ciphertext).
func DeriveKeyHKDF ¶
func DisablePrinting ¶
func DisablePrinting() error
func EnablePrinterHosting ¶
func EnablePrinterHosting() error
func EnablePrinting ¶
func EnablePrinting() error
func EncryptChaCha20Poly1305 ¶
func EncryptPayload ¶
EncryptPayload encrypts plaintext and returns nonce+ciphertext concatenated.
func FetchTURNServers ¶
func ForwardLocalPort ¶
func GetOrRefreshTURNServers ¶
func PerformKeyExchange ¶
func ProxyFileOpHandler ¶
func ProxyFileOpHandler(clientSessions *ClientSessions, cfgDirectory string) xconn.InvocationHandler
func ProxyProgressiveInvocationHandler ¶
func ProxyProgressiveInvocationHandler(proxyCalls *ProxyCalls, clientSessions *ClientSessions, cfgDirectory, procedure string) xconn.InvocationHandler
func ProxyShellHandler ¶
func ProxyShellHandler(proxyCalls *ProxyCalls, clientSessions *ClientSessions, cfgDirectory string) xconn.InvocationHandler
ProxyShellHandler proxies ProcedureShell with transparent PTY migration. On first connection it uses a cloud session for fast start, then upgrades to WebRTC in the background. When WebRTC is ready the daemon migrates the live PTY and stores the WebRTC session for future reuse. If a P2P session is already cached it is used directly with no migration needed.
func RemoveCredentialsFiles ¶
func SetPrintMode ¶
func StartInteractiveCommand ¶
func WritePrincipalsToFile ¶
func WritePrincipalsToFile(principals []*CryptosignPrincipal) error
Types ¶
type Authenticator ¶
func NewAuthenticator ¶
func NewAuthenticator(principals []*CryptosignPrincipal) *Authenticator
func (*Authenticator) Authenticate ¶
func (*Authenticator) Methods ¶
func (a *Authenticator) Methods() []auth.Method
func (*Authenticator) RetrievePrincipal ¶
func (a *Authenticator) RetrievePrincipal(authid string) (*CryptosignPrincipal, bool)
func (*Authenticator) SetPrincipal ¶
func (a *Authenticator) SetPrincipal(authid string, principal *CryptosignPrincipal)
func (*Authenticator) SetPrincipals ¶
func (a *Authenticator) SetPrincipals(principals []*CryptosignPrincipal)
func (*Authenticator) SubscribeEvents ¶
func (a *Authenticator) SubscribeEvents(session *xconn.Session, machineID string) error
type ClientSessions ¶
func NewClientSessions ¶
func NewClientSessions() *ClientSessions
func (*ClientSessions) DeleteDeviceSession ¶
func (c *ClientSessions) DeleteDeviceSession(realm string)
func (*ClientSessions) DeviceSessions ¶
func (c *ClientSessions) DeviceSessions() map[string]int64
func (*ClientSessions) EnsureDeviceSessionWithUpgrade ¶
func (c *ClientSessions) EnsureDeviceSessionWithUpgrade(ctx context.Context, realm, cfgDirectory string) (*xconn.Session, <-chan *xconn.Session, error)
EnsureDeviceSessionWithUpgrade is like EnsureDeviceSession but also returns a channel that receives the WebRTC session when the background upgrade completes. If a connected session is already cached the channel is closed immediately.
func (*ClientSessions) EnsureP2PDeviceSession ¶
func (c *ClientSessions) EnsureP2PDeviceSession(ctx context.Context, realm, cfgDirectory string) (*xconn.Session, error)
EnsureP2PDeviceSession returns the cached session if one exists. Otherwise it establishes a WebRTC connection synchronously — never falling back to cloud.
func (*ClientSessions) LoggedIn ¶
func (c *ClientSessions) LoggedIn() bool
func (*ClientSessions) Login ¶
func (c *ClientSessions) Login()
func (*ClientSessions) Logout ¶
func (c *ClientSessions) Logout()
func (*ClientSessions) SessionByRealm ¶
func (c *ClientSessions) SessionByRealm(authid string) (*xconn.Session, bool)
func (*ClientSessions) StoreDeviceSession ¶
func (c *ClientSessions) StoreDeviceSession(realm string, session *xconn.Session)
type Config ¶
type Config struct {
Devices []Device `yaml:"devices"`
Printing PrintingConfig `yaml:"printing,omitempty"`
}
type Credentials ¶
type Credentials struct {
Realm string `json:"realm"`
AuthID string `json:"authid"`
PublicKey string `json:"public_key"`
PrivateKey string `json:"private_key"` // #nosec
OrganizationID string `json:"organization_id"`
}
func EnsureCredentials ¶
func EnsureCredentials() (*Credentials, error)
type CryptosignPrincipal ¶
type CryptosignPrincipal struct {
AuthID string `json:"authid"`
AuthorizedKeys []string `json:"authorized_keys"`
AuthRole string `json:"authrole"`
}
func ReadPrincipalsFromFile ¶
func ReadPrincipalsFromFile() ([]*CryptosignPrincipal, error)
type Deskconn ¶
type Deskconn struct {
// contains filtered or unexported fields
}
func NewDeskconn ¶
type Device ¶
type Device struct {
Authid string `json:"authid" yaml:"authid"`
ID string `json:"id" yaml:"id"`
Name string `json:"name" yaml:"name"`
Organization Organization `json:"organization" yaml:"organization"`
Realm string `json:"realm" yaml:"realm"`
Alias string `yaml:"alias"`
Connected bool `yaml:"-" json:"-"`
}
func DevicesFromCfg ¶
func FetchDevicesFromCloud ¶
type FileBrowseResult ¶
type FileBrowseResult struct {
Path string `json:"path"`
HomePath string `json:"home_path"`
ParentPath string `json:"parent_path,omitempty"`
Type string `json:"type"`
Mode string `json:"mode"`
Size int64 `json:"size"`
ModTime time.Time `json:"mod_time"`
IsDir bool `json:"is_dir"`
IsSymlink bool `json:"is_symlink"`
LinkTarget string `json:"link_target,omitempty"`
Entries []FileEntry `json:"entries,omitempty"`
}
type FileBrowser ¶
type FileBrowser struct{}
func NewFileBrowser ¶
func NewFileBrowser() *FileBrowser
func (*FileBrowser) Browse ¶
func (f *FileBrowser) Browse(pathArg string) (*FileBrowseResult, error)
func (*FileBrowser) Copy ¶
func (f *FileBrowser) Copy(srcPath, dstPath string) error
func (*FileBrowser) Delete ¶
func (f *FileBrowser) Delete(path string) error
func (*FileBrowser) Rename ¶
func (f *FileBrowser) Rename(oldPath, newPath string) error
type FileEntry ¶
type FileEntry struct {
Name string `json:"name"`
Path string `json:"path"`
Type string `json:"type"`
Mode string `json:"mode"`
Size int64 `json:"size"`
Hidden bool `json:"hidden"`
ModTime time.Time `json:"mod_time"`
IsDir bool `json:"is_dir"`
IsSymlink bool `json:"is_symlink"`
LinkTarget string `json:"link_target,omitempty"`
}
type MPRIS ¶
type MPRIS struct {
// contains filtered or unexported fields
}
func (*MPRIS) NextPlayer ¶
func (*MPRIS) PausePlayer ¶
func (*MPRIS) PlayPausePlayer ¶
func (*MPRIS) PlayPlayer ¶
func (*MPRIS) PreviousPlayer ¶
type Organization ¶
type PrintJobStatus ¶
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
func NewPrinter ¶
func NewPrinter() *Printer
type PrinterInfo ¶
type PrintingConfig ¶
type PrintingConfig struct {
Mode PrintMode `yaml:"mode,omitempty"`
}
type ProxyCalls ¶
func NewProxyCalls ¶
func NewProxyCalls() *ProxyCalls
func (*ProxyCalls) Delete ¶
func (p *ProxyCalls) Delete(id uint64)
func (*ProxyCalls) Store ¶
func (p *ProxyCalls) Store(id uint64, c *ProxyCall)
type Screen ¶
type Screen struct {
// contains filtered or unexported fields
}