fix hop http plugin example

This commit is contained in:
ginuerzh
2024-01-27 21:28:52 +08:00
parent 9c84e29cb8
commit 20ced6222a
2 changed files with 2 additions and 10 deletions
+1 -9
View File
@@ -56,10 +56,6 @@ type hopRequest struct {
Client string `json:"client"`
}
type hopResponse struct {
Node string `json:"node"`
}
func main() {
flag.Parse()
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port))
@@ -80,11 +76,7 @@ func main() {
log.Printf("hop: network=%s addr=%s host=%s client=%s", rb.Network, rb.Addr, rb.Host, rb.Client)
node := nodes[counter.Add(1)%uint64(len(nodes))]
v, _ := json.Marshal(node)
resp := hopResponse{Node: string(v)}
json.NewEncoder(w).Encode(resp)
json.NewEncoder(w).Encode(node)
})
if err := http.Serve(lis, nil); err != nil {
+1 -1
View File
@@ -63,7 +63,7 @@ func main() {
}
resp := observeResponse{
OK: false,
OK: true,
}
for _, event := range rb.Events {