mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-07 13:31:45 -07:00
add VirtualNetworkType.fromInt
This commit is contained in:
parent
d1460ab65b
commit
acf5b3579b
4 changed files with 32 additions and 35 deletions
|
@ -27,15 +27,38 @@
|
|||
|
||||
package com.zerotier.sdk;
|
||||
|
||||
/**
|
||||
* Virtual network type codes
|
||||
*
|
||||
* Defined in ZeroTierOne.h as ZT_VirtualNetworkType
|
||||
*/
|
||||
public enum VirtualNetworkType {
|
||||
|
||||
/**
|
||||
* Private networks are authorized via certificates of membership
|
||||
*/
|
||||
NETWORK_TYPE_PRIVATE,
|
||||
NETWORK_TYPE_PRIVATE(0),
|
||||
|
||||
/**
|
||||
* Public networks have no access control -- they'll always be AUTHORIZED
|
||||
*/
|
||||
NETWORK_TYPE_PUBLIC
|
||||
NETWORK_TYPE_PUBLIC(1);
|
||||
|
||||
@SuppressWarnings({"FieldCanBeLocal", "unused"})
|
||||
private final int id;
|
||||
|
||||
VirtualNetworkType(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public static VirtualNetworkType fromInt(int id) {
|
||||
switch (id) {
|
||||
case 0:
|
||||
return NETWORK_TYPE_PRIVATE;
|
||||
case 1:
|
||||
return NETWORK_TYPE_PUBLIC;
|
||||
default:
|
||||
throw new RuntimeException("Unhandled value: " + id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue