add 44-char dest hashes
This commit is contained in:
6
Makefile
6
Makefile
@ -1,8 +1,10 @@
|
||||
|
||||
USER_GH=eyedeekay
|
||||
VERSION=0.0.2
|
||||
VERSION=0.32.01
|
||||
|
||||
echo:
|
||||
@echo "type make version to do release $(VERSION)"
|
||||
|
||||
version:
|
||||
gothub delete -s $(GITHUB_TOKEN) -u $(USER_GH) -r sam3 -t v$(VERSION) 2> /dev/null; true
|
||||
gothub release -s $(GITHUB_TOKEN) -u $(USER_GH) -r sam3 -t v$(VERSION) -d "version $(VERSION)"
|
||||
|
||||
|
@ -80,13 +80,23 @@ func DestHashFromString(str string) (dhash I2PDestHash, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// get string representation of i2p dest hash
|
||||
// get string representation of i2p dest hash(base32 version)
|
||||
func (h I2PDestHash) String() string {
|
||||
b32addr := make([]byte, 56)
|
||||
i2pB32enc.Encode(b32addr, h[:])
|
||||
return string(b32addr[:52]) + ".b32.i2p"
|
||||
}
|
||||
|
||||
// get base64 representation of i2p dest sha256 hash(the 44-character one)
|
||||
func (h I2PDestHash) Hash() string {
|
||||
hash := sha256.New()
|
||||
hash.Write(h[:])
|
||||
digest := hash.Sum(nil)
|
||||
buf := make([]byte, 44)
|
||||
i2pB64enc.Encode(buf, digest)
|
||||
return string(buf)
|
||||
}
|
||||
|
||||
// Returns "I2P"
|
||||
func (h *I2PDestHash) Network() string {
|
||||
return "I2P"
|
||||
|
@ -44,7 +44,7 @@ func Test_StreamingDial(t *testing.T) {
|
||||
t.Fail()
|
||||
return
|
||||
}
|
||||
fmt.Println("\tDialing i2p-projekt.i2p(", forumAddr.Base32(), ")")
|
||||
fmt.Println("\tDialing i2p-projekt.i2p(", forumAddr.Base32(), forumAddr.DestHash().Hash(), ")")
|
||||
conn, err := ss.DialI2P(forumAddr)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
|
Reference in New Issue
Block a user