mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-07-06 13:01:47 -07:00
Switch to InetSockAddress instead of InetAddress so we can send the port # to java as well
This commit is contained in:
parent
73d68c0c98
commit
d1ed269537
10 changed files with 98 additions and 26 deletions
|
@ -94,14 +94,14 @@ public enum Event {
|
|||
/**
|
||||
* A packet failed authentication
|
||||
*
|
||||
* <p>Meta-data: {@link InetAddress} containing origin address of packet</p>
|
||||
* <p>Meta-data: {@link InetSocketAddress} containing origin address of packet</p>
|
||||
*/
|
||||
EVENT_AUTHENTICATION_FAILURE,
|
||||
|
||||
/**
|
||||
* A received packet was not valid
|
||||
*
|
||||
* <p>Meta-data: {@link InetAddress} containing origin address of packet</p>
|
||||
* <p>Meta-data: {@link InetSocketAddress} containing origin address of packet</p>
|
||||
*/
|
||||
EVENT_INVALID_PACKET,
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
package com.zerotierone.sdk;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.lang.String;
|
||||
|
||||
/**
|
||||
|
@ -45,9 +45,9 @@ public interface EventListener {
|
|||
* Callback for network error events: {@link Event.EVENT_AUTHENTICATION_FAILUER}, {link Event.EVENT_INVALID_PACKET}
|
||||
*
|
||||
* @param event {@link Event} enum
|
||||
* @param source {@link InetAddress} containing the origin address of the packet
|
||||
* @param source {@link InetSocketAddress} containing the origin address of the packet
|
||||
*/
|
||||
public void onNetworkError(Event event, InetAddress source);
|
||||
public void onNetworkError(Event event, InetSocketAddress source);
|
||||
|
||||
/**
|
||||
* Callback when the node detects that it's out of date.
|
||||
|
|
|
@ -29,7 +29,7 @@ package com.zerotierone.sdk;
|
|||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.lang.Long;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
|
@ -152,7 +152,7 @@ public class Node {
|
|||
*/
|
||||
public ResultCode processWirePacket(
|
||||
long now,
|
||||
InetAddress remoteAddress,
|
||||
InetSocketAddress remoteAddress,
|
||||
int linkDesperation,
|
||||
byte[] packetData,
|
||||
long[] nextBackgroundTaskDeadline) {
|
||||
|
@ -377,7 +377,7 @@ public class Node {
|
|||
private native ResultCode processWirePacket(
|
||||
long nodeId,
|
||||
long now,
|
||||
InetAddress remoteAddress,
|
||||
InetSocketAddress remoteAddress,
|
||||
int linkDesperation,
|
||||
byte[] packetData,
|
||||
long[] nextBackgroundTaskDeadline);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
package com.zerotierone.sdk;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
|
||||
public interface PacketSender {
|
||||
|
@ -37,13 +37,13 @@ public interface PacketSender {
|
|||
* on failure. Note that success does not (of course) guarantee packet
|
||||
* delivery. It only means that the packet appears to have been sent.</p>
|
||||
*
|
||||
* @param addr {@link InetAddress} to send to
|
||||
* @param addr {@link InetSocketAddress} to send to
|
||||
* @param linkDesperation
|
||||
* @param packetData data to send
|
||||
* @return 0 on success, any error code on failure.
|
||||
*/
|
||||
public int onSendPacketRequested(
|
||||
InetAddress addr,
|
||||
InetSocketAddress addr,
|
||||
int linkDesperation,
|
||||
byte[] packetData);
|
||||
}
|
||||
|
|
|
@ -27,13 +27,13 @@
|
|||
|
||||
package com.zerotierone.sdk;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
/**
|
||||
* Physical network path to a peer
|
||||
*/
|
||||
public final class PeerPhysicalPath {
|
||||
private InetAddress address;
|
||||
private InetSocketAddress address;
|
||||
private long lastSend;
|
||||
private long lastReceive;
|
||||
private boolean fixed;
|
||||
|
@ -45,7 +45,7 @@ public final class PeerPhysicalPath {
|
|||
/**
|
||||
* Address of endpoint
|
||||
*/
|
||||
public final InetAddress address() {
|
||||
public final InetSocketAddress address() {
|
||||
return address;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package com.zerotierone.sdk;
|
|||
|
||||
import java.lang.String;
|
||||
import java.util.ArrayList;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
public final class VirtualNetworkConfig {
|
||||
public static final int MAX_MULTICAST_SUBSCRIPTIONS = 4096;
|
||||
|
@ -48,7 +48,7 @@ public final class VirtualNetworkConfig {
|
|||
private boolean enabled;
|
||||
private long netconfRevision;
|
||||
private ArrayList<MulticastGroup> multicastSubscriptions;
|
||||
private ArrayList<InetAddress> assignedAddresses;
|
||||
private ArrayList<InetSocketAddress> assignedAddresses;
|
||||
|
||||
private VirtualNetworkConfig() {
|
||||
|
||||
|
@ -155,7 +155,7 @@ public final class VirtualNetworkConfig {
|
|||
}
|
||||
|
||||
/**
|
||||
* ZeroTier-assigned addresses (in {@link java.net.InetAddress} objects)
|
||||
* ZeroTier-assigned addresses (in {@link java.net.InetSocketAddress} objects)
|
||||
*
|
||||
* For IP, the port number of the sockaddr_XX structure contains the number
|
||||
* of bits in the address netmask. Only the IP address and port are used.
|
||||
|
@ -164,7 +164,7 @@ public final class VirtualNetworkConfig {
|
|||
* This is only used for ZeroTier-managed address assignments sent by the
|
||||
* virtual network's configuration master.
|
||||
*/
|
||||
public final ArrayList<InetAddress> assignedAddresses() {
|
||||
public final ArrayList<InetSocketAddress> assignedAddresses() {
|
||||
return assignedAddresses;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue