mirror of
https://github.com/go-i2p/i2pkeys.git
synced 2025-06-08 09:16:22 -04:00
Separate out generate address function and make it's SAM port configurable
This commit is contained in:
@ -189,7 +189,6 @@ func Test_KeyGenerationAndHandling(t *testing.T) {
|
||||
if loadedKeys.Address != keys.Address {
|
||||
// fmt.Printf("loadedKeys.Address md5hash: '%s'\n keys.Address md5hash: '%s'\n", getMD5Hash(string(loadedKeys.Address)), getMD5Hash(string(keys.Address)))
|
||||
t.Errorf("LoadKeysIncompat returned incorrect address. Got '%s', want '%s'", loadedKeys.Address, keys.Address)
|
||||
|
||||
}
|
||||
if loadedKeys.Both != keys.Both {
|
||||
t.Errorf("LoadKeysIncompat returned incorrect pair. Got '%s'\nwant '%s'\n", loadedKeys.Both, keys.Both)
|
||||
@ -199,7 +198,6 @@ func Test_KeyGenerationAndHandling(t *testing.T) {
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
expected := keys.Address.Base64() + "\n" + keys.Both
|
||||
|
@ -128,6 +128,7 @@ func StoreKeysIncompat(k I2PKeys, w io.Writer) error {
|
||||
log.WithField("keys", k).Debug("Keys stored successfully")
|
||||
return nil
|
||||
}
|
||||
|
||||
func StoreKeys(k I2PKeys, r string) error {
|
||||
log.WithField("filename", r).Debug("Storing keys to file")
|
||||
if _, err := os.Stat(r); err != nil {
|
||||
@ -225,4 +226,3 @@ func (k I2PKeys) HostnameEntry(hostname string, opts crypto.SignerOpts) (string,
|
||||
}
|
||||
return string(sig), nil
|
||||
}
|
||||
|
||||
|
4
log.go
4
log.go
@ -4,9 +4,7 @@ import (
|
||||
"github.com/go-i2p/logger"
|
||||
)
|
||||
|
||||
var (
|
||||
log *logger.Logger
|
||||
)
|
||||
var log *logger.Logger
|
||||
|
||||
func InitializeI2PKeysLogger() {
|
||||
logger.InitializeGoI2PLogger()
|
||||
|
5
new.go
5
new.go
@ -9,8 +9,9 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
var DefaultSAMAddress = "127.0.0.1:7656"
|
||||
|
||||
const (
|
||||
defaultSAMAddress = "127.0.0.1:7656"
|
||||
defaultTimeout = 30 * time.Second
|
||||
maxResponseSize = 4096
|
||||
|
||||
@ -30,7 +31,7 @@ type samClient struct {
|
||||
// newSAMClient creates a new SAM client with optional configuration
|
||||
func newSAMClient(options ...func(*samClient)) *samClient {
|
||||
client := &samClient{
|
||||
addr: defaultSAMAddress,
|
||||
addr: DefaultSAMAddress,
|
||||
timeout: defaultTimeout,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user