Panel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
ON THIS PAGE
|
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
interface NetworkHost {
HostConfig defaultConfig();
Promise<HostConfig> getConfig();
Promise<void> applyConfig(HostConfigWritable config);
};
interface HostConfig {
[optional] attribute String proxy;
[optional] attribute Array<String> proxyBypassList;
[optional] attribute Array<String> timeServerList;
[optional] attribute String timeServerInterval;
[optional] attribute String hostName;
[optional] attribute bool forwardingEnabled;
[optional] attribute bool masqueradingEnabled;
[optional] attribute bool loginPassword;
};
interface HostConfigWritable : HostConfig {
[optional] attribute String[or bool] loginPassword;
[optional] attribute String[or bool] obfuscatedLoginPassword;
}; |
...
[String] proxy
: The name or address of the proxy server used for HTTP and FTP requests. The proxy string should be formatted as "http://user:password@hostname:port". The hostname can contain up to four "*" characters; each "*" character can be used to replace one octet from the current IP address. For example, if the IP address is currently 192.168.1.2, and the proxy is set to "proxy-*-*", then the player will attempt to use a proxy named "proxy-192-168".[Array<String>] proxyBypassList
: A list of hostnames exempted from the proxy setting. The player will attempt to reach the specified hosts directly rather than using the proxy specified in theproxy
attribute. For example, the hostname "example.com" would exempt "example.com", "example.com:80", and "www.example.com" from the proxy setting.[Array<String>] timeServerList
: An array containing zero or one time servers to be used by the player. An empty array disables automatic setting of the player's clock. A single entry indicates the time server and protocol that should be used as a URL. Supported protocols are HTTP, HTTPS and NTP. For backward-compatibility the use of just a host name is supported and indicates that NTP should be used. Note that when using HTTPS, host and peer verification are disabled since the player clock may not be correct. The following are valid time server addresses:[String] timeServerInterval
: A value specifying how often (in seconds) the player should communicate with the time server to adjust its clock. The default interval is 12 hours. The minimum interval allowed is 120 seconds.[String] hostName
: The player host name. If no host name has been explicitly set, then a host name is automatically generated based on the device serial number. Passing an empty string to this method resets the device host name to its automatically generated value.[bool] loginPassword
: A value of true means that the password exists, false means that there is no password.[bool] forwardingEnabled:
A flag that enables or disables IP forwarding. IP forwarding is disabled (false) by default.[bool] masqueradingEnabled:
A flag that enables or disables source address translation with IP forwarding. IfforwardingEnabled
is true,masqueradingEnabled
must be specified as true or false:- If
masqueradingEnabled
is false, IP datagrams are forwarded between all interfaces and no address translation is done. - If
masqueradingEnabled
is true, IP datagrams are forwarded between all interfaces, but SNAT is applied to any datagrams which are sent out of an "upstream" interface (any interface or interfaces on which a default route is set). Datagrams destined for an interface that has no default route are forwarded without NAT.
- If
[Array<NatRule>] natList:
A list of DNAT rules which lets users change the destination address and port of a packet.
...
This behavior ensures that code such as getConfig().then((c) => { applyConfig(c); })
preserves any existing password, even though the password itself is not returned by getConfig()
.
NatRuleMatch
The rules in this interface are compared to destinations in the TCP or UDP packets that enter the player. If the packet fields match the properties established in NatRuleMatch
, the destination IP and port will be overwritten with the desired values in the NatRulesReplacement
interface.
[String] protocol:
Filter for "udp" or "tcp" (the entry must be lower case).[optional] [String] sourceAddressRange:
Filter for this range of source IP addresses (in CIDR format). Traffic from all source IP addresses will be included if this optional attribute is not specified.- [
String] destinationAddressRange:
The range of destination IP addresses (in CIDR format) to be overwritten. [unsigned short] destinationPort:
The destination port to be overwritten.
NatRuleReplacement
The address and port properties specified in NatRuleReplacement
are written to the packet to replace selected IP address and port properties.
- [
String] destinationAddress:
The IP address that will replace the previous IP address in the destination. [unsigned short] destinationPort:
The port that will replace the previous port in the destination.
Examples
The following script uses the applyConfig()
method to set the hostname, time server, and time-server refresh interval:
...