beautified default peer names

pull/402/head
Michael Peter Christen 4 years ago
parent a9befbba5f
commit baad56d83d

@ -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 to listen for a shutdown signal ( -1 = disable use of a shutdown port, 8005 = recommended default )
port.shutdown = -1 port.shutdown = -1
# prefix for new default peer names
peernameprefix=_anon
# use UPnP [true/false] # use UPnP [true/false]
upnp.enabled = true upnp.enabled = true
# remote host on UPnP device (for more than one connection) # remote host on UPnP device (for more than one connection)

@ -92,7 +92,7 @@ import net.yacy.utils.crypt;
public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed> 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; public static final int maxsize = 16000;
/** /**
@ -319,10 +319,17 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
* @return * @return
*/ */
private static String defaultPeerName() { private static String defaultPeerName() {
return ANON_PREFIX Random r = new Random(System.currentTimeMillis());
+ OS.infoKey() 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; + Network.speedKey;
} }

@ -340,9 +340,6 @@ public final class Switchboard extends serverSwitch {
setLog(new ConcurrentLog("SWITCHBOARD")); setLog(new ConcurrentLog("SWITCHBOARD"));
AccessTracker.setDumpFile(new File(dataPath, "DATA/LOG/queries.log")); AccessTracker.setDumpFile(new File(dataPath, "DATA/LOG/queries.log"));
// set default peer name
Seed.ANON_PREFIX = getConfig("peernameprefix", "_anon");
// set timeoutrequests // set timeoutrequests
boolean timeoutrequests = getConfigBool("timeoutrequests", true); boolean timeoutrequests = getConfigBool("timeoutrequests", true);
TimeoutRequest.enable = timeoutrequests; TimeoutRequest.enable = timeoutrequests;

Loading…
Cancel
Save