summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBen Morrison <ben@gbmor.dev>2019-06-18 23:32:46 -0400
committerBen Morrison <ben@gbmor.dev>2019-06-18 23:32:46 -0400
commit41398b172a5fd908195a31fe1cd1e727eac95051 (patch)
treefd22fc061476aadd61e648dbb4fc198dd6565b32
parentc5daf914198948ef96cb463641ecc734471bcdd5 (diff)
downloadgetwtxt-41398b172a5fd908195a31fe1cd1e727eac95051.tar.gz
changes related to registry-v0.3.0 v0.4.3
-rw-r--r--go.mod6
-rw-r--r--go.sum12
-rw-r--r--svc/cache_test.go2
-rw-r--r--svc/db_test.go4
-rw-r--r--svc/init.go2
-rw-r--r--svc/init_test.go4
-rw-r--r--svc/post.go2
-rw-r--r--svc/post_test.go6
-rw-r--r--svc/query_test.go6
9 files changed, 22 insertions, 22 deletions
diff --git a/go.mod b/go.mod
index 6c5991d..c595b1f 100644
--- a/go.mod
+++ b/go.mod
@@ -4,7 +4,7 @@ go 1.11
 
 require (
 	github.com/fsnotify/fsnotify v1.4.7
-	github.com/getwtxt/registry v0.2.4
+	github.com/getwtxt/registry v0.3.0
 	github.com/golang/snappy v0.0.1 // indirect
 	github.com/gorilla/handlers v1.4.0
 	github.com/gorilla/mux v1.7.2
@@ -19,7 +19,7 @@ require (
 	github.com/spf13/viper v1.4.0
 	github.com/stretchr/testify v1.3.0 // indirect
 	github.com/syndtr/goleveldb v1.0.0
-	golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 // indirect
-	golang.org/x/sys v0.0.0-20190613124609-5ed2794edfdc
+	golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b // indirect
+	golang.org/x/sys v0.0.0-20190618155005-516e3c20635f
 	golang.org/x/text v0.3.2 // indirect
 )
diff --git a/go.sum b/go.sum
index 5eb1f4e..db3044a 100644
--- a/go.sum
+++ b/go.sum
@@ -21,8 +21,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
 github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
 github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
 github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
-github.com/getwtxt/registry v0.2.4 h1:pSOMWtNRkAmrN9XoLVbib7Ll3/wF1pXFaQ+b1NTbIvQ=
-github.com/getwtxt/registry v0.2.4/go.mod h1:BGSIALOFqIRj+ACLB8etWGUOgFAKN8oFDpCsw6YOdYQ=
+github.com/getwtxt/registry v0.3.0 h1:5uOtEHhg2ot5ukzuJxnEXnTWEMsCKXgQxR8nBA0/63Q=
+github.com/getwtxt/registry v0.3.0/go.mod h1:BGSIALOFqIRj+ACLB8etWGUOgFAKN8oFDpCsw6YOdYQ=
 github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
@@ -146,8 +146,8 @@ golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73r
 golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
 golang.org/x/net v0.0.0-20190522155817-f3200d17e092 h1:4QSRKanuywn15aTZvI/mIDEgPQpswuFndXpOj3rKEco=
 golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
-golang.org/x/net v0.0.0-20190613194153-d28f0bde5980 h1:dfGZHvZk057jK2MCeWus/TowKpJ8y4AmooUzdBSR9GU=
-golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b h1:lkjdUzSyJ5P1+eal9fxXX9Xg2BTfswsonKUse48C0uE=
+golang.org/x/net v0.0.0-20190619014844-b5b0513f8c1b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
 golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -159,8 +159,8 @@ golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5h
 golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
 golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190613124609-5ed2794edfdc h1:x+/QxSNkVFAC+v4pL1f6mZr1z+qgi+FoR8ccXZPVC10=
-golang.org/x/sys v0.0.0-20190613124609-5ed2794edfdc/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190618155005-516e3c20635f h1:dHNZYIYdq2QuU6w73vZ/DzesPbVlZVYZTtTZmrnsbQ8=
+golang.org/x/sys v0.0.0-20190618155005-516e3c20635f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
diff --git a/svc/cache_test.go b/svc/cache_test.go
index f167913..af2b1de 100644
--- a/svc/cache_test.go
+++ b/svc/cache_test.go
@@ -45,7 +45,7 @@ func Test_cacheUpdate(t *testing.T) {
 		t.Logf("both are in the expected order. I need to do some more investigation before I can correct the test")
 		t.Logf("or correct the library functions.")
 		t.SkipNow()
-		raw, _, _ := registry.GetTwtxt(urls)
+		raw, _, _ := registry.GetTwtxt(urls, nil)
 		manual, _ := registry.ParseUserTwtxt(raw, "gbmor", urls)
 
 		if !reflect.DeepEqual(newStatus, manual) {
diff --git a/svc/db_test.go b/svc/db_test.go
index 3c0abdf..7d3386c 100644
--- a/svc/db_test.go
+++ b/svc/db_test.go
@@ -11,7 +11,7 @@ func Test_pushpullDatabase(t *testing.T) {
 	initTestConf()
 	initTestDB()
 
-	out, _, err := registry.GetTwtxt("https://gbmor.dev/twtxt.txt")
+	out, _, err := registry.GetTwtxt("https://gbmor.dev/twtxt.txt", nil)
 	if err != nil {
 		t.Errorf("Couldn't set up test: %v\n", err)
 	}
@@ -55,7 +55,7 @@ func Benchmark_pushDatabase(b *testing.B) {
 	initTestDB()
 
 	if _, ok := twtxtCache.Users["https://gbmor.dev/twtxt.txt"]; !ok {
-		out, _, err := registry.GetTwtxt("https://gbmor.dev/twtxt.txt")
+		out, _, err := registry.GetTwtxt("https://gbmor.dev/twtxt.txt", nil)
 		if err != nil {
 			b.Errorf("Couldn't set up benchmark: %v\n", err)
 		}
diff --git a/svc/init.go b/svc/init.go
index b00f45d..3e7ab5e 100644
--- a/svc/init.go
+++ b/svc/init.go
@@ -42,7 +42,7 @@ var cTickC = make(chan *tick, 1)
 var tmpls *template.Template
 
 // Holds the registry data in-memory
-var twtxtCache = registry.NewIndex()
+var twtxtCache = registry.NewIndex(nil)
 
 // List of other registries submitted to this registry
 var remoteRegistries = &RemoteRegistries{
diff --git a/svc/init_test.go b/svc/init_test.go
index 314d5f4..72c8e3f 100644
--- a/svc/init_test.go
+++ b/svc/init_test.go
@@ -91,8 +91,8 @@ func testConfig() {
 // Creates a fresh mock registry, with a single
 // user and their statuses, for testing.
 func mockRegistry() {
-	twtxtCache = registry.NewIndex()
-	statuses, _, _ := registry.GetTwtxt("https://gbmor.dev/twtxt.txt")
+	twtxtCache = registry.NewIndex(nil)
+	statuses, _, _ := registry.GetTwtxt("https://gbmor.dev/twtxt.txt", nil)
 	parsed, _ := registry.ParseUserTwtxt(statuses, "gbmor", "https://gbmor.dev/twtxt.txt")
 	_ = twtxtCache.AddUser("gbmor", "https://gbmor.dev/twtxt.txt", "1", net.ParseIP("127.0.0.1"), parsed)
 }
diff --git a/svc/post.go b/svc/post.go
index 46032b9..9baafbe 100644
--- a/svc/post.go
+++ b/svc/post.go
@@ -28,7 +28,7 @@ func apiPostUser(w http.ResponseWriter, r *http.Request) {
 
 	uip := getIPFromCtx(r.Context())
 
-	out, remoteRegistry, err := registry.GetTwtxt(urls)
+	out, remoteRegistry, err := registry.GetTwtxt(urls, twtxtCache.Client)
 	if err != nil {
 		errHTTP(w, r, fmt.Errorf("error fetching twtxt Data: %v", err.Error()), http.StatusBadRequest)
 		return
diff --git a/svc/post_test.go b/svc/post_test.go
index cee324c..1c7e9b5 100644
--- a/svc/post_test.go
+++ b/svc/post_test.go
@@ -46,7 +46,7 @@ var apiPostUserCases = []struct {
 func Test_apiPostUser(t *testing.T) {
 	initTestConf()
 	portnum := fmt.Sprintf(":%v", confObj.Port)
-	twtxtCache = registry.NewIndex()
+	twtxtCache = registry.NewIndex(nil)
 
 	for _, tt := range apiPostUserCases {
 		t.Run(tt.name, func(t *testing.T) {
@@ -78,7 +78,7 @@ func Test_apiPostUser(t *testing.T) {
 func Benchmark_apiPostUser(b *testing.B) {
 	initTestConf()
 	portnum := fmt.Sprintf(":%v", confObj.Port)
-	twtxtCache = registry.NewIndex()
+	twtxtCache = registry.NewIndex(nil)
 
 	params := url.Values{}
 	params.Set("url", "https://gbmor.dev/twtxt.txt")
@@ -91,7 +91,7 @@ func Benchmark_apiPostUser(b *testing.B) {
 		apiEndpointPOSTHandler(rr, req)
 
 		b.StopTimer()
-		twtxtCache = registry.NewIndex()
+		twtxtCache = registry.NewIndex(nil)
 		b.StartTimer()
 	}
 }
diff --git a/svc/query_test.go b/svc/query_test.go
index 687b102..414f99b 100644
--- a/svc/query_test.go
+++ b/svc/query_test.go
@@ -45,7 +45,7 @@ func Test_parseQueryOut(t *testing.T) {
 	urls := "https://gbmor.dev/twtxt.txt"
 	nick := "gbmor"
 
-	out, _, err := registry.GetTwtxt(urls)
+	out, _, err := registry.GetTwtxt(urls, nil)
 	if err != nil {
 		t.Errorf("Couldn't set up test: %v\n", err)
 	}
@@ -79,7 +79,7 @@ func Benchmark_parseQueryOut(b *testing.B) {
 	urls := "https://gbmor.dev/twtxt.txt"
 	nick := "gbmor"
 
-	out, _, err := registry.GetTwtxt(urls)
+	out, _, err := registry.GetTwtxt(urls, nil)
 	if err != nil {
 		b.Errorf("Couldn't set up test: %v\n", err)
 	}
@@ -184,7 +184,7 @@ func Test_compositeStatusQuery(t *testing.T) {
 
 func Benchmark_compositeStatusQuery(b *testing.B) {
 	initTestConf()
-	statuses, _, _ := registry.GetTwtxt("https://gbmor.dev/twtxt.txt")
+	statuses, _, _ := registry.GetTwtxt("https://gbmor.dev/twtxt.txt", nil)
 	parsed, _ := registry.ParseUserTwtxt(statuses, "gbmor", "https://gbmor.dev/twtxt.txt")
 	_ = twtxtCache.AddUser("gbmor", "https://gbmor.dev/twtxt.txt", "1", net.ParseIP("127.0.0.1"), parsed)
 	b.ResetTimer()