mirror of
https://github.com/netbirdio/netbird.git
synced 2026-08-24 16:41:30 +02:00
Adds an SSHClient gomobile binding so the Android app can run an SSH session over the tunnel with a PTY, exposed through a listener interface for the in-app terminal. Server type is auto-detected from the SSH banner, which selects the auth path: JWT device-code flow, NetBird key, or a regular server (NetBird key first, then password). Host keys are verified against the peer registry for NetBird servers and trust-on-first-use for regular ones.
39 lines
936 B
Go
39 lines
936 B
Go
//go:build android
|
|
|
|
package android
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/netbirdio/netbird/client/internal/profilemanager"
|
|
)
|
|
|
|
type prefsStore interface {
|
|
Get(namespace string, v any) (bool, error)
|
|
Put(namespace string, v any) error
|
|
}
|
|
|
|
type profilePrefs struct {
|
|
prefs *profilemanager.Prefs
|
|
}
|
|
|
|
func newProfilePrefs(configDir, profileID string) (*profilePrefs, error) {
|
|
if configDir == "" || profileID == "" {
|
|
return nil, fmt.Errorf("profile prefs require a config dir and profile ID")
|
|
}
|
|
pm := NewProfileManager(configDir)
|
|
prefs, err := pm.serviceMgr.ProfilePrefs(profilemanager.ID(profileID), androidUsername)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("resolve profile prefs: %w", err)
|
|
}
|
|
return &profilePrefs{prefs: prefs}, nil
|
|
}
|
|
|
|
func (p *profilePrefs) Get(namespace string, v any) (bool, error) {
|
|
return p.prefs.Get(namespace, v)
|
|
}
|
|
|
|
func (p *profilePrefs) Put(namespace string, v any) error {
|
|
return p.prefs.Put(namespace, v)
|
|
}
|