mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-07 05:21:42 -07:00
make VirtualNetworkRoute a plain data class
This commit is contained in:
parent
d0c0585553
commit
809022b273
4 changed files with 58 additions and 49 deletions
|
@ -29,34 +29,39 @@ package com.zerotier.sdk;
|
|||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
public final class VirtualNetworkRoute implements Comparable<VirtualNetworkRoute>
|
||||
/**
|
||||
* A route to be pushed on a virtual network
|
||||
*
|
||||
* Defined in ZeroTierOne.h as ZT_VirtualNetworkRoute
|
||||
*/
|
||||
public class VirtualNetworkRoute implements Comparable<VirtualNetworkRoute>
|
||||
{
|
||||
private VirtualNetworkRoute() {
|
||||
target = null;
|
||||
via = null;
|
||||
flags = 0;
|
||||
metric = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Target network / netmask bits (in port field) or NULL or 0.0.0.0/0 for default
|
||||
*/
|
||||
public InetSocketAddress target;
|
||||
|
||||
private final InetSocketAddress target;
|
||||
|
||||
/**
|
||||
* Gateway IP address (port ignored) or NULL (family == 0) for LAN-local (no gateway)
|
||||
*/
|
||||
public InetSocketAddress via;
|
||||
private final InetSocketAddress via;
|
||||
|
||||
/**
|
||||
* Route flags
|
||||
*/
|
||||
public int flags;
|
||||
private final int flags;
|
||||
|
||||
/**
|
||||
* Route metric (not currently used)
|
||||
*/
|
||||
public int metric;
|
||||
private final int metric;
|
||||
|
||||
public VirtualNetworkRoute(InetSocketAddress target, InetSocketAddress via, int flags, int metric) {
|
||||
this.target = target;
|
||||
this.via = via;
|
||||
this.flags = flags;
|
||||
this.metric = metric;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -139,4 +144,20 @@ public final class VirtualNetworkRoute implements Comparable<VirtualNetworkRoute
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
public InetSocketAddress getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public InetSocketAddress getVia() {
|
||||
return via;
|
||||
}
|
||||
|
||||
public int getFlags() {
|
||||
return flags;
|
||||
}
|
||||
|
||||
public int getMetric() {
|
||||
return metric;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue