fix up structure

This commit is contained in:
Jeff Becker
2016-08-17 09:19:56 -04:00
parent b3f8b208cd
commit f1094c0ffe
16 changed files with 244 additions and 89 deletions

View File

@ -89,6 +89,19 @@ func (router_info RouterInfo) RouterIdentity() (router_identity RouterIdentity,
return
}
//
// Calculate this RouterInfo's Identity Hash (the sha256 of the RouterIdentity)
// returns error if the RouterIdentity is malformed
//
func (router_info RouterInfo) IdentHash() (h Hash, err error) {
var ri RouterIdentity
ri, err = router_info.RouterIdentity()
if err == nil {
h = HashData(ri)
}
return
}
//
// Return the Date the RouterInfo was published and any errors encountered parsing the RouterInfo.
//
@ -196,6 +209,7 @@ func (router_info RouterInfo) Options() (mapping Mapping) {
func (router_info RouterInfo) Signature() (signature Signature) {
head := router_info.optionsLocation()
size := head + router_info.optionsSize()
// TODO: signature is not always 40 bytes, is 40 bytes for DSA only
signature = Signature(router_info[size : size+40])
return
}