feat:完善信息
This commit is contained in:
@ -82,12 +82,12 @@ func TestNewInstance2(t *testing.T) {
|
||||
client := _new()
|
||||
|
||||
query := elastic.NewBoolQuery()
|
||||
query.Must(elastic.NewMatchQuery("title", "一种"))
|
||||
//query.Must(elastic.NewMatchQuery("title", "一种"))
|
||||
//query.Must(elastic.NewMatchPhraseQuery("industry", "你是"))
|
||||
|
||||
service := client.Search().
|
||||
//Index("es_patent_index")
|
||||
Index("es_manage_index_1")
|
||||
Index("es_manage_index_2")
|
||||
|
||||
result, err := service.From(0).Size(10).
|
||||
//Explain(true).
|
||||
|
@ -2,11 +2,9 @@ package web
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
@ -61,18 +59,19 @@ func (this *Web) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
//remoteUrl, _ := url.Parse("http://192.168.0.147:9000")
|
||||
fmt.Println(r.Host)
|
||||
// 获取
|
||||
ip, _, err := net.SplitHostPort(strings.TrimSpace(r.RemoteAddr))
|
||||
|
||||
if err != nil {
|
||||
_, _ = w.Write([]byte("403: Host forbidden"))
|
||||
return
|
||||
}
|
||||
remoteIP := net.ParseIP(ip)
|
||||
|
||||
if remoteIP == nil {
|
||||
_, _ = w.Write([]byte("403: Host forbidden"))
|
||||
return
|
||||
}
|
||||
//ip, _, err := net.SplitHostPort(strings.TrimSpace(r.RemoteAddr))
|
||||
//
|
||||
//if err != nil {
|
||||
// _, _ = w.Write([]byte("403: Host forbidden"))
|
||||
// return
|
||||
//}
|
||||
//remoteIP := net.ParseIP(ip)
|
||||
//
|
||||
//if remoteIP == nil {
|
||||
// _, _ = w.Write([]byte("403: Host forbidden"))
|
||||
// return
|
||||
//}
|
||||
//fmt.Println(remoteIP)
|
||||
|
||||
if this.function != nil {
|
||||
pass, callback := this.function(r.Host)
|
||||
@ -86,8 +85,6 @@ func (this *Web) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
callback(r)
|
||||
}
|
||||
}
|
||||
//hostProxy[host] = proxy // 放入缓存
|
||||
//w.Write([]byte("403: Host forbidden " + r.Host))
|
||||
this.handler.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user