expanded logging to session_key.go
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// Package session_key implements the I2P SessionKey common data structure
|
||||
package session_key
|
||||
|
||||
import log "github.com/sirupsen/logrus"
|
||||
|
||||
/*
|
||||
[SessionKey]
|
||||
Accurate for version 0.9.49
|
||||
@@ -22,13 +24,20 @@ type SessionKey [32]byte
|
||||
// Returns a list of errors that occurred during parsing.
|
||||
func ReadSessionKey(bytes []byte) (info SessionKey, remainder []byte, err error) {
|
||||
// TODO: stub
|
||||
log.Warn("ReadSessionKey is not implemented")
|
||||
return
|
||||
}
|
||||
|
||||
// NewSessionKey creates a new *SessionKey from []byte using ReadSessionKey.
|
||||
// Returns a pointer to SessionKey unlike ReadSessionKey.
|
||||
func NewSessionKey(data []byte) (session_key *SessionKey, remainder []byte, err error) {
|
||||
log.WithField("input_length", len(data)).Debug("Creating new SessionKey")
|
||||
sessionKey, remainder, err := ReadSessionKey(data)
|
||||
if err != nil {
|
||||
log.WithError(err).Error("Failed to create new SessionKey")
|
||||
return nil, remainder, err
|
||||
}
|
||||
session_key = &sessionKey
|
||||
log.Debug("Successfully created new SessionKey")
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user