diff --git a/core/core.go b/core/core.go index 4b17d6ceb..dd5887ef5 100644 --- a/core/core.go +++ b/core/core.go @@ -64,7 +64,7 @@ type IpfsNode struct { Namesys namesys.Resolver // the routing publisher - Publisher *namesys.IpnsPublisher + Publisher namesys.Publisher } // NewIpfsNode constructs a new IpfsNode based on the given config. diff --git a/namesys/publisher.go b/namesys/publisher.go index a4292d7fe..76eb6a55b 100644 --- a/namesys/publisher.go +++ b/namesys/publisher.go @@ -12,20 +12,24 @@ import ( u "github.com/jbenet/go-ipfs/util" ) -type IpnsPublisher struct { +type ipnsPublisher struct { dag *mdag.DAGService routing routing.IpfsRouting } -func NewPublisher(dag *mdag.DAGService, route routing.IpfsRouting) *IpnsPublisher { - return &IpnsPublisher{ +type Publisher interface { + Publish(ci.PrivKey, string) error +} + +func NewPublisher(dag *mdag.DAGService, route routing.IpfsRouting) Publisher { + return &ipnsPublisher{ dag: dag, routing: route, } } // Publish accepts a keypair and a value, -func (p *IpnsPublisher) Publish(k ci.PrivKey, value string) error { +func (p *ipnsPublisher) Publish(k ci.PrivKey, value string) error { log.Debug("namesys: Publish %s", value) ctx := context.TODO() data, err := CreateEntryData(k, value) diff --git a/namesys/resolve_test.go b/namesys/resolve_test.go index 7cad8bef0..35898b50f 100644 --- a/namesys/resolve_test.go +++ b/namesys/resolve_test.go @@ -28,7 +28,7 @@ func TestRoutingResolve(t *testing.T) { resolve := NewMasterResolver(d, dag) - pub := IpnsPublisher{ + pub := ipnsPublisher{ dag: dag, routing: d, }