proxy
The sos.management.proxy
API groups together methods for managing the proxy settings on the device.
Proxy Management Capabilities
Capability | Description |
---|---|
PROXY | If device supports Proxy setup connection |
If you want to check if the device supports this capability, use sos.management.supports()
.
Methods
disable()
The disable()
method disables the proxy on the device.
disable(): Promise<void>;
Return value
A promise that resolves when the proxy is disabled.
Possible errors
If the device does not support proxy management.
Example
await sos.management.proxy.disable();
getConnectedTo()
The getConnectedTo()
method returns the current connected proxy server URI on the device.
getConnectedTo(): Promise<string>;
Return value
A promise that resolves to the URI of the connected proxy server.
Possible errors
If the device does not support proxy management.
Example
const uri = await sos.management.proxy.getConnectedTo();
console.log(uri); // 178.62.193.192
isEnabled()
The isEnabled()
method returns whether the proxy is enabled on the device.
isEnabled(): Promise<boolean>;
Return value
A promise that resolves to a boolean indicating if the proxy is enabled.
Example
const enabled = await sos.management.proxy.isEnabled();
console.log(`Proxy is enabled: ${enabled}`);
setManual()
The setManual()
allows you to manually configure the proxy settings on the device.
setManual(uri: string, port: number, username?: string, password?: string): Promise<void>;
Params
Name | Type | Required | Description |
---|---|---|---|
uri | string | Yes | The URI of the proxy server |
port | number | Yes | The port of the proxy server |
username | string | No | The username for the proxy server |
password | string | No | The password for the proxy server |
Return value
A promise that resolves when the proxy is set.
Possible errors
- If the proxy settings are invalid.
- If the device does not support proxy management.
Example
await sos.management.proxy.setManual('178.62.193.192', 1080, 'username', 'password');