Removed test hooks

pull/18/head
Hugo Landau 10 years ago
parent ada6e55c08
commit 02e72d352a

@ -11,11 +11,13 @@ import "net"
import "github.com/hlandau/ncdns/namecoin"
import "github.com/hlandau/madns/merr"
import "github.com/hlandau/ncdns/util"
import "sync"
type Backend struct {
//s *Server
nc namecoin.NamecoinConn
cache lru.Cache // items are of type *Domain
cacheMutex sync.Mutex
cfg Config
}
@ -85,6 +87,9 @@ func toNamecoinName(basename string) (string, error) {
}
func (b *Backend) getNamecoinEntry(name string) (*domain, error) {
b.cacheMutex.Lock()
defer b.cacheMutex.Unlock()
if dd, ok := b.cache.Get(name); ok {
d := dd.(*domain)
return d, nil

@ -27,23 +27,6 @@ type NamecoinConn struct {
// If the domain exists, returns the value stored in Namecoin, which should be JSON.
// Note that this will return domain data even if the domain is expired.
func (nc *NamecoinConn) Query(name string) (v string, err error) {
if name == "d/badger2" {
v = `{"ns":["ns1.badger.bit","ns2.badger.bit"],"map":{"ns1":{"ip":["1.2.3.4"],"ip6":["::beef:1"]},"ns2":{"ip":["2.3.4.5"],"ip6":["::beef:2"]}},"ds":[[12345,8,2,"lu6y/9mwDNRpTngni179qwqARGVntp9jTaB48NkPAbo="]]}`
return
}
if name == "d/badger" {
v = `{"ns":["ns1.badger.bit.genoq.org"],"map":{"ns1":{"ip":["192.99.208.248"]}},"ds":[[4015,8,1,"zvJorv4AV1it/HukLVw5wc6wtnI="],[4015,8,2,"mGW8W55p5JajShyDBvmAdPFOAEcA8IMDzwL0nO5AxAQ="]]}`
return
}
if name == "d/secure" {
v = `{"ns":["ns1.example.com","ns2.example.com"],"ds":[[12345,8,2,"lu6y/9mwDNRpTngni179qwqARGVntp9jTaB48NkPAbo="]]}`
return
}
if name == "d/insecure" {
v = `{"ns":["ns1.example.com","ns2.example.com"]}`
return
}
cmd, err := extratypes.NewNameShowCmd(newID(), name)
if err != nil {
//log.Info("NC NEWCMD ", err)

@ -44,6 +44,7 @@ func NewServer(cfg *ServerConfig) (s *Server, err error) {
bcfg := &backend.Config {
RPCUsername: cfg.NamecoinRPCUsername,
RPCPassword: cfg.NamecoinRPCPassword,
RPCAddress: cfg.NamecoinRPCAddress,
CacheMaxEntries: cfg.CacheMaxEntries,
SelfName: cfg.SelfName,
SelfIP: cfg.SelfIP,

Loading…
Cancel
Save