Skip to content

Commit 211a43a

Browse files
authored
Specify port when trying to determine egress interface. (#59)
Specifying the DNS port when trying to route to a root server seems to work better (at least on Mac with temurin JDK 17).
1 parent 7033192 commit 211a43a

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ UUID anotherUuid = gen.generate();
7676
If your machine has a standard IP networking setup, the `Generators.egressTimeBasedGenerator` (added in JUG 4.1)
7777
factory method will try to determine which network interface corresponds to the default route for
7878
all outgoing network traffic, and use that for creating a time based generator.
79-
This is likely a good choice for common usage scenarios if you want a version 1 UUID generator:
79+
This is likely a good choice for common usage scenarios if you want a version 1 UUID generator, but unfortunately
80+
is known not to work reliably on some platforms.
8081

8182
```java
8283
TimeBasedGenerator gen = Generators.egressTimeBasedGenerator();

src/main/java/com/fasterxml/uuid/EthernetAddress.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public static EthernetAddress fromEgressInterface()
325325
String roots = "abcdefghijklm";
326326
int index = new Random().nextInt(roots.length());
327327
String name = roots.charAt(index) + ".root-servers.net";
328-
InetSocketAddress externalAddress = new InetSocketAddress(name, 0);
328+
InetSocketAddress externalAddress = new InetSocketAddress(name, 53);
329329
if (externalAddress.isUnresolved()) {
330330
externalAddress = new InetSocketAddress("1.1.1.1", 0);
331331
}

0 commit comments

Comments
 (0)