asaur-ificate package and imports

This commit is contained in:
Dan Ballard 2018-10-09 14:42:32 -07:00
parent bce6496829
commit 29e3a42cc9
2 changed files with 8 additions and 7 deletions

View File

@ -12,7 +12,7 @@ import (
// "127.0.0.1:9051" "tcp4" // "127.0.0.1:9051" "tcp4"
// "/var/run/tor/control" "unix" // "/var/run/tor/control" "unix"
func SetupOnion(torControlAddress string, torControlSocketType string, authentication string, pk *rsa.PrivateKey, onionport uint16) (net.Listener, error) { func SetupOnion(torControlAddress string, torControlSocketType string, authentication string, pk *rsa.PrivateKey, onionport uint16) (net.Listener, error) {
c, err := bulb.Dial(torControlSocketType, torControlAddress) c, err := asaur.Dial(torControlSocketType, torControlAddress)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -21,7 +21,7 @@ func SetupOnion(torControlAddress string, torControlSocketType string, authentic
return nil, err return nil, err
} }
cfg := &bulb.NewOnionConfig{ cfg := &asaur.NewOnionConfig{
DiscardPK: true, DiscardPK: true,
PrivateKey: pk, PrivateKey: pk,
} }
@ -30,7 +30,7 @@ func SetupOnion(torControlAddress string, torControlSocketType string, authentic
} }
func SetupOnionV3(torControlAddress string, torControlSocketType string, authentication string, pk ed25519.PrivateKey, onionstr string, onionport uint16) (net.Listener, error) { func SetupOnionV3(torControlAddress string, torControlSocketType string, authentication string, pk ed25519.PrivateKey, onionstr string, onionport uint16) (net.Listener, error) {
c, err := bulb.Dial(torControlSocketType, torControlAddress) c, err := asaur.Dial(torControlSocketType, torControlAddress)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -48,12 +48,12 @@ func SetupOnionV3(torControlAddress string, torControlSocketType string, authent
copy(privkey[0:32], digest[:32]) copy(privkey[0:32], digest[:32])
copy(privkey[32:64], digest[32:]) copy(privkey[32:64], digest[32:])
onionPK := &bulb.OnionPrivateKey{ onionPK := &asaur.OnionPrivateKey{
KeyType: "ED25519-V3", KeyType: "ED25519-V3",
Key: base64.StdEncoding.EncodeToString(privkey[0:64]), Key: base64.StdEncoding.EncodeToString(privkey[0:64]),
} }
cfg := &bulb.NewOnionConfig{ cfg := &asaur.NewOnionConfig{
Onion: onionstr, Onion: onionstr,
DiscardPK: true, DiscardPK: true,
PrivateKey: onionPK, PrivateKey: onionPK,

View File

@ -55,7 +55,7 @@ func (nr *NetworkResolver) Resolve(hostname string) (net.Conn, string, error) {
conn, err := torDialer.Dial("tcp", resolvedHostname+".onion:9878") conn, err := torDialer.Dial("tcp", resolvedHostname+".onion:9878")
if err != nil { if err != nil {
torc, err := bulb.Dial("tcp4", "127.0.0.1:9051") torc, err := asaur.Dial("tcp4", "127.0.0.1:9051")
if err != nil { if err != nil {
log.Printf("%v\n", err) log.Printf("%v\n", err)
return nil, "", err return nil, "", err
@ -74,8 +74,9 @@ func (nr *NetworkResolver) Resolve(hostname string) (net.Conn, string, error) {
} }
// runs SIGNAL NEWNYM on the tor control port to flush the onion descriptors cache // runs SIGNAL NEWNYM on the tor control port to flush the onion descriptors cache
func NewNym(c *bulb.Conn) error { func NewNym(c *asaur.Conn) error {
_, err := c.Request("SIGNAL NEWNYM") _, err := c.Request("SIGNAL NEWNYM")
if err != nil { if err != nil {
c.Close() c.Close()
} }