Documentation
¶
Overview ¶
Package mobile provides the gomobile bindings for honey.
Index ¶
- func ClearDeviceMTLS()
- func Exec(requestJSON string) (string, error)
- func ExecuteRecipe(requestJSON string, cb LogCallback) (string, error)
- func GetVersion() string
- func InitDefaultConfig(homeDir, configDir, cacheDir, recordDir, recipesDir string) error
- func KeyFingerprint(pemKey, passphrase string) (string, error)
- func ListBackends(requestJSON string) (string, error)
- func LoadConfig(configDir string) (string, error)
- func MeshStatus() string
- func ResolveExitNode(requestJSON string) (string, error)
- func SaveConfig(configDir string, configJSON string) error
- func SearchHosts(requestJSON string) (string, error)
- func SetDeviceMTLS(chainPEM, caPEM string, signer MTLSSigner)
- func StartVPN(tunFd int, requestJSON string, cb VPNCallback) error
- func StopVPN() error
- type LogCallback
- type MTLSSigner
- type VPNCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearDeviceMTLS ¶
func ClearDeviceMTLS()
ClearDeviceMTLS removes the registered device mTLS credential (e.g. on logout).
func Exec ¶
Exec runs a shell command on all hosts matching the backends filter. requestJSON: {"config_path":"...","backends":"prod-*","command":"uptime","ssh_user":"ubuntu"} Returns: {"results":[{"host":"...","output":"...","exit_code":0,"error":"..."}]}
func ExecuteRecipe ¶
func ExecuteRecipe(requestJSON string, cb LogCallback) (string, error)
ExecuteRecipe is the gomobile entrypoint.
func GetVersion ¶
func GetVersion() string
GetVersion returns the honey binary version embedded at build time.
func InitDefaultConfig ¶
InitDefaultConfig initializes the config.yaml file with default paths if they are not set.
func KeyFingerprint ¶
KeyFingerprint validates an SSH private key and returns JSON describing it: {"type":"ED25519","fingerprint":"SHA256:..."}. A passphrase may be supplied for encrypted keys. Returns an error for invalid keys or a wrong passphrase.
func ListBackends ¶
ListBackends takes a JSON serialized config path request and returns a JSON serialized hostapi.ListBackendsOutput.
func LoadConfig ¶
LoadConfig reads the honey config from configDir/config.yaml and returns it as JSON. Returns a minimal empty-config JSON if the file does not exist (first-run case).
func MeshStatus ¶ added in v0.3.7
func MeshStatus() string
MeshStatus reports this process's libp2p mesh connectivity as JSON: {"peer_id":"...","connected":true,"relays":["..."]}, or {"error":"..."} when mesh was never started (disabled, or startMeshIfConfigured hasn't run yet). Optional/diagnostic — nothing in pkg/mobile requires a caller to check this before using a mesh-routed honey backend.
func ResolveExitNode ¶
ResolveExitNode resolves the SSH exit host so the Android VpnService can build its route table (excluding the exit IP) before establish() yields the TUN fd. requestJSON: {"config_path","backends","name","ssh_user"} returns: {"name","ip","ssh_port","tunnel_routes":["a.b.c.d/32",...]} tunnel_routes is every CIDR EXCEPT the exit IP — i.e. the set the caller must addRoute() into the TUN so SSH-carrier traffic to the exit stays on the physical interface and does not loop through the tunnel.
func SaveConfig ¶
SaveConfig writes a JSON-encoded honey config to configDir/config.yaml. Creates the directory if it does not exist.
func SearchHosts ¶
SearchHosts takes a JSON serialized hostapi.SearchHostsInput and returns a JSON serialized hostapi.SearchHostsOutput.
func SetDeviceMTLS ¶
func SetDeviceMTLS(chainPEM, caPEM string, signer MTLSSigner)
SetDeviceMTLS registers the device client-certificate chain (PEM), the gateway server CA (PEM; empty falls back to system roots), and the signer callback. After this, honey backends marked mtls are reached over the device client cert by the in-process engine (search, backend listing, and WS exec/tunnel).
func StartVPN ¶
func StartVPN(tunFd int, requestJSON string, cb VPNCallback) error
StartVPN attaches the tun2socks engine to an existing VpnService TUN fd and pumps it through a fresh SOCKS5-over-SSH tunnel to the requested exit host. Non-blocking; lifecycle and traffic are streamed via cb. Returns an error if a VPN session is already running or initial connect fails.
Types ¶
type LogCallback ¶
LogCallback is implemented by Kotlin to receive real-time updates.
type MTLSSigner ¶
MTLSSigner is implemented on the mobile side (Android Keystore). Sign returns an ASN.1 DER ECDSA signature over the given already-hashed digest. The private key stays in the device TEE; only signatures cross the boundary.
type VPNCallback ¶
VPNCallback is implemented by Kotlin to receive VPN lifecycle and traffic updates. State is one of: "resolving", "connecting", "connected", "stopping", "disconnected", "error". statsJSON carries cumulative and live throughput: {"up_total","down_total","up_rate","down_rate","uptime_s"}.