diff --git a/check_test.go b/check_test.go index af9c720..5df9f48 100644 --- a/check_test.go +++ b/check_test.go @@ -23,7 +23,7 @@ func TestCheckDomain(t *testing.T) { t.Log(CheckDomain(d)) t.Log(CheckDomain(d1)) - t.Log(CheckDomain(d1)) - t.Log(CheckDomain(d1)) + t.Log(CheckDomain(d2)) + t.Log(CheckDomain(d3)) t.Log(CheckDomain(d4)) } diff --git a/elasticsearch_test.go b/elasticsearch_test.go index 8d28072..5461253 100644 --- a/elasticsearch_test.go +++ b/elasticsearch_test.go @@ -62,7 +62,7 @@ func TestIndexDocument(t *testing.T) { } func TestIndexQuerySimple(t *testing.T) { - _, err := IndexQuerySimple(INDEX, TYPE, "JS") + _, err := IndexQuerySimple(INDEX, TYPE, 10, 1, "JS") if err != nil { t.Error(err) } diff --git a/ping.go b/ping.go new file mode 100644 index 0000000..3b0a53f --- /dev/null +++ b/ping.go @@ -0,0 +1,40 @@ +package main + +import ( + "fmt" + "io/ioutil" + "net/http" + "net/url" + + "github.com/eiblog/utils/logd" +) + +type Feeder interface { + PingFunc(url string) +} + +// superfeedr +// http://.superfeedr.com/ +type Superfeedr struct { + URL string +} + +func (f *Superfeedr) PingFunc(urls ...string) { + vals := url.Values{} + vals.Set("hub.mode", "publish") + for _, u := range urls { + vals.Add("hub.url", u) + } + res, err := http.PostForm(f.URL, vals) + if err != nil { + logd.Error(err) + return + } + defer res.Body.Close() + data, err := ioutil.ReadAll(res.Body) + if err != nil { + logd.Error(err) + return + } + fmt.Println(string(data), res.StatusCode) +} diff --git a/ping_test.go b/ping_test.go new file mode 100644 index 0000000..ef66429 --- /dev/null +++ b/ping_test.go @@ -0,0 +1,14 @@ +// Package main provides ... +package main + +import ( + "fmt" + "testing" + + "github.com/eiblog/eiblog/setting" +) + +func TestPing(t *testing.T) { + sf := Superfeedr{URL: fmt.Sprintf("https://%s.superfeedr.com", setting.Conf.Superfeedr)} + sf.PingFunc("https://deepzz.com/rss.html") +} diff --git a/pingrpc2.go b/pingrpc2.go deleted file mode 100644 index 23c7da7..0000000 --- a/pingrpc2.go +++ /dev/null @@ -1,4 +0,0 @@ -package main - -// baidu==>http://zhanzhang.baidu.com/tools/ping -// http://ping.baidu.com/ping/RPC2