-
Notifications
You must be signed in to change notification settings - Fork 6
/
call_back.go
41 lines (32 loc) · 958 Bytes
/
call_back.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"context"
v2 "github.com/envoyproxy/go-control-plane/envoy/api/v2"
"log"
)
type MyCallbacks struct{}
func (cb *MyCallbacks) Report() {
log.Println("Report...")
}
func (cb *MyCallbacks) OnStreamOpen(ctx context.Context, id int64, typ string) error {
log.Println("OnStreamOpen...")
return nil
}
func (cb *MyCallbacks) OnStreamClosed(id int64) {
log.Println("OnStreamClosed...")
}
func (cb *MyCallbacks) OnStreamRequest(int64, *v2.DiscoveryRequest) error {
log.Println("OnStreamRequest...")
return nil
}
func (cb *MyCallbacks) OnStreamResponse(int64, *v2.DiscoveryRequest, *v2.DiscoveryResponse) {
log.Println("OnStreamResponse...")
cb.Report()
}
func (cb *MyCallbacks) OnFetchRequest(ctx context.Context, req *v2.DiscoveryRequest) error {
log.Println("OnFetchRequest, req:", req)
return nil
}
func (cb *MyCallbacks) OnFetchResponse(*v2.DiscoveryRequest, *v2.DiscoveryResponse) {
log.Println("OnFetchResponse...")
}