...
1 package pkg
2
3 import (
4 "encoding/binary"
5
6 netPb "github.com/linkerd/linkerd2/controller/gen/common/net"
7 tapPb "github.com/linkerd/linkerd2/viz/tap/gen/tap"
8 )
9
10
11 func CreateTapEvent(eventHTTP *tapPb.TapEvent_Http, dstMeta map[string]string, proxyDirection tapPb.TapEvent_ProxyDirection) *tapPb.TapEvent {
12 event := &tapPb.TapEvent{
13 ProxyDirection: proxyDirection,
14 Source: &netPb.TcpAddress{
15 Ip: &netPb.IPAddress{
16 Ip: &netPb.IPAddress_Ipv4{
17 Ipv4: uint32(1),
18 },
19 },
20 },
21 Destination: &netPb.TcpAddress{
22 Ip: &netPb.IPAddress{
23 Ip: &netPb.IPAddress_Ipv6{
24 Ipv6: &netPb.IPv6{
25
26 First: binary.BigEndian.Uint64([]byte{0xff, 0x01, 0, 0, 0, 0, 0, 0}),
27 Last: binary.BigEndian.Uint64([]byte{0, 0, 0, 0, 0, 0, 0, 0x01}),
28 },
29 },
30 },
31 },
32 Event: &tapPb.TapEvent_Http_{
33 Http: eventHTTP,
34 },
35 DestinationMeta: &tapPb.TapEvent_EndpointMeta{
36 Labels: dstMeta,
37 },
38 }
39 return event
40 }
41
View as plain text