Package net.i2p.client.naming
Class HostTxtEntry
java.lang.Object
net.i2p.client.naming.HostTxtEntry
A hostname, b64 destination, and optional properties.
Includes methods to sign and verify the entry.
Used by addressbook to parse subscription data,
and by i2ptunnel to generate signed metadata.
- Since:
- 0.9.26
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final char
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final char
static final String
static final String
-
Constructor Summary
ConstructorDescriptionHostTxtEntry
(String sprops) A 'remove' entry.HostTxtEntry
(String name, String dest) Properties will be nullHostTxtEntry
(String name, String dest, String sprops) HostTxtEntry
(String name, String dest, OrderedProperties props) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Compares Destination only, not propertiesgetDest()
getName()
getProps()
int
hashCode()
boolean
Verify with the "olddest" property's public key using the "oldsig" propertyboolean
Verify with the "dest" property's public key using the "sig" propertyboolean
Verify with the dest public key using the "sig" propertyvoid
sign
(SigningPrivateKey spk) Sign and set the "sig" property Must have been constructed with non-null properties.void
Sign and set the "oldsig" property Must have been constructed with non-null properties.void
Sign as a "remove" line #!dest=dest#name=name#k1=v1#sig=sig...] Must have been constructed with non-null properties.void
write
(BufferedWriter out) Write as a standard line name=dest[#!k1=v1#k2=v2...] Includes newline.void
Write as a standard line name=dest[#!k1=v1#k2=v2...] Does not include newline.void
writeProps
(Writer out) Write the props part (if any) only, without newlinevoid
writeRemove
(Writer out) Write as a "remove" line #!dest=dest#name=name#k1=v1#sig=sig...] This works whether constructed with name and dest, or just properties.void
Write as a "remove" line #!dest=dest#name=name#k1=v1#sig=sig...] This works whether constructed with name and dest, or just properties.
-
Field Details
-
KV_SEPARATOR
public static final char KV_SEPARATOR- See Also:
-
PROPS_SEPARATOR
- See Also:
-
PROP_SEPARATOR
public static final char PROP_SEPARATOR- See Also:
-
PROP_ACTION
- See Also:
-
PROP_DATE
- See Also:
-
PROP_DEST
- See Also:
-
PROP_EXPIRES
- See Also:
-
PROP_NAME
- See Also:
-
PROP_OLDDEST
- See Also:
-
PROP_OLDNAME
- See Also:
-
PROP_OLDSIG
- See Also:
-
PROP_SIG
- See Also:
-
ACTION_ADDDEST
- See Also:
-
ACTION_ADDNAME
- See Also:
-
ACTION_ADDSUBDOMAIN
- See Also:
-
ACTION_CHANGEDEST
- See Also:
-
ACTION_CHANGENAME
- See Also:
-
ACTION_REMOVE
- See Also:
-
ACTION_REMOVEALL
- See Also:
-
ACTION_UPDATE
- See Also:
-
-
Constructor Details
-
HostTxtEntry
Properties will be null -
HostTxtEntry
- Parameters:
sprops
- line part after the #!, non-null- Throws:
IllegalArgumentException
- on dup key in sprops and other errors
-
HostTxtEntry
A 'remove' entry. Name and Dest will be null.- Parameters:
sprops
- line part after the #!, non-null- Throws:
IllegalArgumentException
- on dup key in sprops and other errors
-
HostTxtEntry
- Parameters:
props
- may be null
-
-
Method Details
-
getName
-
getDest
-
getProps
-
write
Write as a standard line name=dest[#!k1=v1#k2=v2...] Includes newline.- Throws:
IOException
-
write
Write as a standard line name=dest[#!k1=v1#k2=v2...] Does not include newline.- Throws:
IOException
-
writeRemoveLine
Write as a "remove" line #!dest=dest#name=name#k1=v1#sig=sig...] This works whether constructed with name and dest, or just properties. Includes newline. Must have been constructed with non-null properties.- Throws:
IOException
-
writeRemove
Write as a "remove" line #!dest=dest#name=name#k1=v1#sig=sig...] This works whether constructed with name and dest, or just properties. Does not include newline. Must have been constructed with non-null properties.- Throws:
IOException
-
writeProps
Write the props part (if any) only, without newline- Throws:
IOException
-
hasValidSig
public boolean hasValidSig()Verify with the dest public key using the "sig" property -
hasValidInnerSig
public boolean hasValidInnerSig()Verify with the "olddest" property's public key using the "oldsig" property -
hasValidRemoveSig
public boolean hasValidRemoveSig()Verify with the "dest" property's public key using the "sig" property -
hashCode
public int hashCode() -
equals
Compares Destination only, not properties -
sign
Sign and set the "sig" property Must have been constructed with non-null properties. -
signInner
Sign and set the "oldsig" property Must have been constructed with non-null properties. -
signRemove
Sign as a "remove" line #!dest=dest#name=name#k1=v1#sig=sig...] Must have been constructed with non-null properties.
-