java.lang.Object
org.klomp.snark.ClientID.Profile
- Enclosing class:
ClientID
One impersonatable client: peer ID prefix plus the matching tracker User-Agent and extension handshake "v" strings.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final booleanTrue to name the OS and Java in the peer id.private final StringExtension version advertised in the peer id.private final StringClient name shown in the logs.private final byte[]Exact leading peer ID bytes, 5-8 long, e.g.private final StringPeer id prefix this profile sends, null for none.private final StringUser-Agent base; ";<OS>;Java <ver>" appended when appendOsJava is set.Constructor Summary
Method Summary
Public MethodsModifier and TypeMethodDescriptionbyte[]buildPeerId(Random random) A fresh 20-byte peer ID: this profile's prefix followed by random alphanumeric bytes.The BEP 10 extension handshake "v" value.getName()The profile name, also the accepted i2psnark.clientId token.(package private) StringThe ASCII peer ID prefix, e.g.The HTTP User-Agent for tracker announces and webseed fetches.toString()
Field Details
name
Client name shown in the logs.peerIdPrefixStr
Peer id prefix this profile sends, null for none.peerIdPrefix
private final byte[] peerIdPrefixExact leading peer ID bytes, 5-8 long, e.g. "-AZ5770-" or "TIX34".uaBase
User-Agent base; ";<OS>;Java <ver>" appended when appendOsJava is set.appendOsJava
private final boolean appendOsJavaTrue to name the OS and Java in the peer id.extV
Extension version advertised in the peer id.
Constructor Details
Profile
Describes one client identity profile.- Parameters:
n- the client nameprefix- the peer id prefix, null for noneua- the user agent for trackersosJava- true to name the OS and Java in the peer idv- the extension version advertised
Method Details
getName
The profile name, also the accepted i2psnark.clientId token.- Returns:
- the name identifying this profile
getPeerIdPrefix
String getPeerIdPrefix()The ASCII peer ID prefix, e.g. "-AZ5770-". Package visible for tests.- Returns:
- the prefix string
buildPeerId
A fresh 20-byte peer ID: this profile's prefix followed by random alphanumeric bytes.- Parameters:
random- the randomness source- Returns:
- a new 20-byte peer ID
getUserAgent
The HTTP User-Agent for tracker announces and webseed fetches. Never null.- Returns:
- the base user agent, with ";OS;Java version" appended when this profile requests it
getExtHandshakeName
The BEP 10 extension handshake "v" value. Never null.- Returns:
- the extension protocol version string advertised in the handshake
toString