java.lang.Object
net.i2p.router.message.OutboundClientMessageJobHelper
Static methods to create a Garlic Message with one or more cloves.
GarlicMessage
Ack Clove (optional)
Tunnel delivery instructions
Garlic Message
Delivery Status Clove
Local delivery instructions
Delivery Status Message
LeaseSet Clove (optional)
Local delivery instructions
Database Store Message
Data Clove (required)
Destination delivery instructions
Data Message
The low-level construction is in GarlicMessageBuilder.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final longExtra ms an ack lives beyond its payload's expiryConstructor Summary
ConstructorsModifierConstructorDescriptionprivateUtility class, not intended for instantiation.Method Summary
Private MethodsModifier and TypeMethodDescriptionprivate static PayloadGarlicConfigbuildAckClove(RouterContext ctx, Hash from, TunnelInfo replyToTunnel, long replyToken, long expiration, SessionKeyManager skm) Build a clove that sends a DeliveryStatusMessage to us.private static DeliveryStatusMessagebuildDSM(RouterContext ctx, long replyToken) Make a basic DSM.private static PayloadGarlicConfigbuildLeaseSetClove(RouterContext ctx, long expiration, LeaseSet replyLeaseSet) Build a clove that stores the leaseSet locally.private static GarlicConfigcreateGarlicConfig(RouterContext ctx, long replyToken, long expiration, PublicKey recipientPK, PayloadGarlicConfig dataClove, Hash from, Destination dest, TunnelInfo replyTunnel, boolean requireAck, LeaseSet bundledReplyLeaseSet, SessionKeyManager skm) Make the top-level config, with a data clove, an optional ack clove, and an optional leaseset clove.(package private) static GarlicMessagecreateGarlicMessage(RouterContext ctx, long replyToken, long expiration, PublicKey recipientPK, PayloadGarlicConfig dataClove, Hash from, Destination dest, TunnelInfo replyTunnel, int tagsToSendOverride, int lowTagsOverride, SessionKey wrappedKey, Set<SessionTag> wrappedTags, boolean requireAck, LeaseSet bundledReplyLeaseSet, ReplyCallback callback) Build a garlic message that will be delivered to the router on which the target is located.private static GarlicMessagewrapDSM(RouterContext ctx, SessionKeyManager skm, DeliveryStatusMessage dsm, long expiration) Wrap a DSM in a GarlicMessage, add the fake session to the SKM.
Field Details
ACK_EXTRA_EXPIRATION
private static final long ACK_EXTRA_EXPIRATIONExtra ms an ack lives beyond its payload's expiry- See Also:
Constructor Details
OutboundClientMessageJobHelper
private OutboundClientMessageJobHelper()Utility class, not intended for instantiation.
Method Details
createGarlicMessage
static GarlicMessage createGarlicMessage(RouterContext ctx, long replyToken, long expiration, PublicKey recipientPK, PayloadGarlicConfig dataClove, Hash from, Destination dest, TunnelInfo replyTunnel, int tagsToSendOverride, int lowTagsOverride, SessionKey wrappedKey, Set<SessionTag> wrappedTags, boolean requireAck, LeaseSet bundledReplyLeaseSet, ReplyCallback callback) Build a garlic message that will be delivered to the router on which the target is located. Inside the message are two cloves: one containing the payload with instructions for delivery to the (now local) destination, and the other containing a DeliveryStatusMessage with instructions for delivery to an inbound tunnel of this router.How the DeliveryStatusMessage is wrapped can vary - it can be simply sent to a tunnel (as above), wrapped in a GarlicMessage and source routed a few hops before being tunneled, source routed the entire way back, or not wrapped at all - in which case the payload clove contains a SourceRouteBlock and a request for a reply.
For now, its just a tunneled DeliveryStatusMessage
Allow the app to specify the data clove directly, which enables OutboundClientMessage to resend the same payload (including expiration and unique id) in different garlics (down different tunnels). This is called from OCMOSJ.
- Parameters:
ctx- the router contextreplyToken- the reply tokenexpiration- the message expirationrecipientPK- the recipient public keydataClove- may be null for ECIES-layer ackfrom- the sender hashdest- the remote destination the message is addressed toreplyTunnel- non-null if requireAck is true or bundledReplyLeaseSet is non-nulltagsToSendOverride- if > 0, use this instead of skm's defaultlowTagsOverride- if > 0, use this instead of skm's defaultwrappedKey- for ElGamal, non-null with null data, output parameter that will be filled with the SessionKey used, may be null for ECIESwrappedTags- for ElGamal, output parameter that will be filled with the sessionTags used, may be null for ECIESrequireAck- if true, bundle replyToken in an ack clovebundledReplyLeaseSet- may be null; if non-null, put it in a clovecallback- only for ECIES, may be null- Returns:
- garlic, or null if no tunnels were found (or other errors)
createGarlicConfig
private static GarlicConfig createGarlicConfig(RouterContext ctx, long replyToken, long expiration, PublicKey recipientPK, PayloadGarlicConfig dataClove, Hash from, Destination dest, TunnelInfo replyTunnel, boolean requireAck, LeaseSet bundledReplyLeaseSet, SessionKeyManager skm) Make the top-level config, with a data clove, an optional ack clove, and an optional leaseset clove.The returned GarlicConfig will have the recipientPublicKey set.
- Parameters:
ctx- the router context, source of the log and the random clove set IDsreplyToken- the token the receiver echoes back in the ack, negative when no reply is expectedexpiration- the expiration time in milliseconds, also used for the ack clove 60 seconds laterrecipientPK- the key the whole message is encrypted to, set on the returned configdataClove- may be null for ECIES-layer ackfrom- our own hash, named in the log when the ack clove cannot be builtdest- the remote destination we are sending to, named in the INFO logreplyTunnel- non-null if requireAck is true or bundledReplyLeaseSet is non-nullrequireAck- if true, bundle replyToken in an ack clovebundledReplyLeaseSet- may be null; if non-null, put it in a cloveskm- encrypt dsm with this skm non-null- Returns:
- null on error
buildAckClove
private static PayloadGarlicConfig buildAckClove(RouterContext ctx, Hash from, TunnelInfo replyToTunnel, long replyToken, long expiration, SessionKeyManager skm) Build a clove that sends a DeliveryStatusMessage to us. As of 0.9.12, the DSM is wrapped in a GarlicMessage.- Parameters:
ctx- the router context, source of the log, our keys and the random clove set IDsfrom- our own hash, whose keys are looked up and named when no inbound tunnel is availablereplyToTunnel- the inbound tunnel the ack travels back on, null means no ack is possiblereplyToken- the token the DSM carries so the receiver can match it to the data messageexpiration- the clove's expiration time in millisecondsskm- encrypt dsm with this skm non-null- Returns:
- null on error
buildDSM
Make a basic DSM.- Parameters:
ctx- the context the message is created forreplyToken- the message id the receiver matches the ack against- Returns:
- a DSM stamped with the current time and the given reply token
wrapDSM
private static GarlicMessage wrapDSM(RouterContext ctx, SessionKeyManager skm, DeliveryStatusMessage dsm, long expiration) Wrap a DSM in a GarlicMessage, add the fake session to the SKM. Since 0.9.12 it is encrypted, to hide it from the target and the return path OBEP and IBGW.- Parameters:
ctx- the router context, source of the random session key and tagsskm- encrypt dsm with this skm non-nulldsm- the delivery status message to wrapexpiration- the message's expiration time in milliseconds, from which the fake session's lifetime is taken- Returns:
- null on error
buildLeaseSetClove
private static PayloadGarlicConfig buildLeaseSetClove(RouterContext ctx, long expiration, LeaseSet replyLeaseSet) Build a clove that stores the leaseSet locally.- Parameters:
ctx- the router context, source of the random clove set IDexpiration- the clove's expiration time in millisecondsreplyLeaseSet- the lease set the target is asked to store for us- Returns:
- a clove with local delivery instructions, carrying the database store message