Skip to content

Commit

Permalink
Naming: Add .i2p.alt support to naming services
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzi2p committed Jan 30, 2024
1 parent c6e6e79 commit 4b75710
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,10 @@ private static Integer getReverseKey(Hash hash) {
*/
@Override
public Destination lookup(String hostname, Properties lookupOptions, Properties storedOptions) {
if (hostname.endsWith(".i2p.alt")) {
// RFC 9476
hostname = hostname.substring(0, hostname.length() - 4);
}
Destination rv = lookup2(hostname, lookupOptions, storedOptions);
if (rv == null) {
// if hostname starts with "www.", strip and try again
Expand Down
4 changes: 4 additions & 0 deletions core/java/src/net/i2p/client/naming/DummyNamingService.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ protected DummyNamingService(I2PAppContext context) {
*/
@Override
public Destination lookup(String hostname, Properties lookupOptions, Properties storedOptions) {
if (hostname.endsWith(".i2p.alt")) {
// RFC 9476
hostname = hostname.substring(0, hostname.length() - 4);
}
Destination d = getCache(hostname);
if (d != null)
return d;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ public String getName() {
*/
@Override
public Destination lookup(String hostname, Properties lookupOptions, Properties storedOptions) {
if (hostname.endsWith(".i2p.alt")) {
// RFC 9476
hostname = hostname.substring(0, hostname.length() - 4);
}
try {
String key = getKey(hostname);
if (key == null && hostname.startsWith("www.") && hostname.length() > 7)
Expand Down

0 comments on commit 4b75710

Please sign in to comment.