Skip to content

Commit

Permalink
beautified default peer names
Browse files Browse the repository at this point in the history
  • Loading branch information
Orbiter committed Dec 14, 2020
1 parent a9befbb commit baad56d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
3 changes: 0 additions & 3 deletions defaults/yacy.init
Expand Up @@ -16,9 +16,6 @@ port.ssl = 8443
# port to listen for a shutdown signal ( -1 = disable use of a shutdown port, 8005 = recommended default )
port.shutdown = -1

# prefix for new default peer names
peernameprefix=_anon

# use UPnP [true/false]
upnp.enabled = true
# remote host on UPnP device (for more than one connection)
Expand Down
15 changes: 11 additions & 4 deletions source/net/yacy/peers/Seed.java
Expand Up @@ -92,7 +92,7 @@
public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
{

public static String ANON_PREFIX = "_anon";
public static String ANON_PREFIX = "agent";

public static final int maxsize = 16000;
/**
Expand Down Expand Up @@ -319,10 +319,17 @@ public static String checkPeerName(String name) {
* @return
*/
private static String defaultPeerName() {
return ANON_PREFIX
+ OS.infoKey()
Random r = new Random(System.currentTimeMillis());
char[] n = new char[7];
for (int i = 0; i < 7; i++) {
n[i] = i % 2 == 1 ? "aeiou".charAt(r.nextInt(5)) : "bdfghklmnprst".charAt(r.nextInt(13));
}
return
ANON_PREFIX
+ "-"
+ (System.currentTimeMillis() % 77777777L)
+ new String(n)
+ "-"
+ OS.infoKey()
+ "-"
+ Network.speedKey;
}
Expand Down
3 changes: 0 additions & 3 deletions source/net/yacy/search/Switchboard.java
Expand Up @@ -340,9 +340,6 @@ public Switchboard(final File dataPath, final File appPath, final String initPat
setLog(new ConcurrentLog("SWITCHBOARD"));
AccessTracker.setDumpFile(new File(dataPath, "DATA/LOG/queries.log"));

// set default peer name
Seed.ANON_PREFIX = getConfig("peernameprefix", "_anon");

// set timeoutrequests
boolean timeoutrequests = getConfigBool("timeoutrequests", true);
TimeoutRequest.enable = timeoutrequests;
Expand Down

0 comments on commit baad56d

Please sign in to comment.