comply with spec

update spec
pull/1/head
Jeff Becker 6 years ago
parent a8ab66f4f8
commit d2700f818b
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

@ -165,7 +165,7 @@ x is the timestamp seconds since epoch that this introducer expires at
{
k: "<32 bytes public identity key of router>",
p: path_id_uint64,
p: "<16 bytes path id>",
v: 0,
x: time_expires_seconds_since_epoch_uint64
}

@ -22,11 +22,12 @@ namespace llarp
bool
BDecode(llarp_buffer_t *buf);
static bool
OnKey(dict_reader *r, llarp_buffer_t *buf);
bool
BEncode(llarp_buffer_t *buf) const;
private:
static bool
OnKey(dict_reader *r, llarp_buffer_t *buf);
};
struct LR_AcceptRecord
@ -42,18 +43,6 @@ namespace llarp
BEncode(llarp_buffer_t *buf) const;
};
struct LR_StatusMessage
{
std::vector< EncryptedFrame > replies;
uint64_t version;
bool
BDecode(llarp_buffer_t *buf);
bool
BEncode(llarp_buffer_t *buf) const;
};
struct LR_CommitMessage : public ILinkMessage
{
std::vector< EncryptedFrame > frames;
@ -64,6 +53,7 @@ namespace llarp
LR_CommitMessage(const RouterID &from) : ILinkMessage(from)
{
}
~LR_CommitMessage();
void

@ -1,8 +1,21 @@
#ifndef LLARP_FS_HPP
#define LLARP_FS_HPP
#if(__cplusplus >= 201703L)
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#else
#error "fs support unimplemented"
#include <string>
namespace fs
{
static std::string Sep = "/";
struct path
{
};
}
#endif
#endif

@ -45,23 +45,23 @@ llarp_rc_decode_dict(struct dict_reader *r, llarp_buffer_t *key)
return llarp_ai_list_bdecode(rc->addrs, r->buffer);
}
if(llarp_buffer_eq(*key, "e"))
if(llarp_buffer_eq(*key, "k"))
{
if(!bencode_read_string(r->buffer, &strbuf))
return false;
if(strbuf.sz != PUBKEYSIZE)
return false;
memcpy(rc->enckey, strbuf.base, PUBKEYSIZE);
memcpy(rc->pubkey, strbuf.base, PUBKEYSIZE);
return true;
}
if(llarp_buffer_eq(*key, "k"))
if(llarp_buffer_eq(*key, "p"))
{
if(!bencode_read_string(r->buffer, &strbuf))
return false;
if(strbuf.sz != PUBKEYSIZE)
return false;
memcpy(rc->pubkey, strbuf.base, PUBKEYSIZE);
memcpy(rc->enckey, strbuf.base, PUBKEYSIZE);
return true;
}
@ -176,18 +176,18 @@ llarp_rc_bencode(struct llarp_rc *rc, llarp_buffer_t *buff)
return false;
}
/* write encryption pubkey */
if(!bencode_write_bytestring(buff, "e", 1))
return false;
if(!bencode_write_bytestring(buff, rc->enckey, PUBKEYSIZE))
return false;
/* write signing pubkey */
if(!bencode_write_bytestring(buff, "k", 1))
return false;
if(!bencode_write_bytestring(buff, rc->pubkey, PUBKEYSIZE))
return false;
/* write encryption pubkey */
if(!bencode_write_bytestring(buff, "p", 1))
return false;
if(!bencode_write_bytestring(buff, rc->enckey, PUBKEYSIZE))
return false;
/* write last updated */
if(!bencode_write_bytestring(buff, "u", 1))
return false;

Loading…
Cancel
Save