mirror of
https://codeberg.org/cunicu/cunicu.git
synced 2025-09-26 21:01:14 +08:00
hooks: add support for web- and subprocess hooks which are triggered by common events
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
@@ -50,6 +50,34 @@ route_sync:
|
||||
|
||||
table: main
|
||||
|
||||
# Pass events to external processes or web hook handlers
|
||||
hooks:
|
||||
- type: exec
|
||||
command: ../../scripts/hook.sh
|
||||
|
||||
# Prepend additional arguments
|
||||
args: []
|
||||
|
||||
# Pass JSON object via Stdin to command
|
||||
stdin: true
|
||||
|
||||
# Set environment variables for invocation
|
||||
env:
|
||||
COLOR: "1"
|
||||
|
||||
- type: web
|
||||
|
||||
# URL of the webhook endpoint
|
||||
url: https://my-webhook-endpoint.com/api/v1/webhook
|
||||
|
||||
# HTTP method of request
|
||||
method: POST
|
||||
|
||||
# Pass additional headers
|
||||
headers:
|
||||
User-Agent: ahoi
|
||||
Authorization: Bearer XXXXXX
|
||||
|
||||
# Discover the WireGuard endpoint of peers
|
||||
endpoint_disc:
|
||||
enabled: true
|
||||
|
@@ -80,6 +80,7 @@ func NewConfig(flags *pflag.FlagSet) *Config {
|
||||
c.SetDefaults()
|
||||
|
||||
// Feature flags
|
||||
flags.BoolP("hooks", "K", true, "Enable execution of hooks")
|
||||
flags.BoolP("host-sync", "H", true, "Enable synchronization of /etc/hosts file")
|
||||
flags.BoolP("config-sync", "S", true, "Enable synchronization of WireGuard configuration files")
|
||||
flags.BoolP("endpoint-disc", "I", true, "Enable ICE endpoint discovery")
|
||||
@@ -135,6 +136,9 @@ func NewConfig(flags *pflag.FlagSet) *Config {
|
||||
flags.StringP("community", "x", "", "A community `passphrase` for discovering other peers")
|
||||
|
||||
flagMap := map[string]string{
|
||||
// Hooks
|
||||
"hooks": "hooks.enabled",
|
||||
|
||||
// Config sync
|
||||
"config-sync": "config_sync.enabled",
|
||||
"config-path": "config_sync.path",
|
||||
@@ -362,8 +366,8 @@ func decodeOption(cfg *mapstructure.DecoderConfig) {
|
||||
mapstructure.StringToTimeDurationHookFunc(),
|
||||
mapstructure.StringToSliceHookFunc(","),
|
||||
mapstructure.TextUnmarshallerHookFunc(),
|
||||
hookDecodeHook,
|
||||
)
|
||||
|
||||
cfg.ZeroFields = false
|
||||
cfg.TagName = "yaml"
|
||||
}
|
||||
@@ -375,3 +379,20 @@ func (c *Config) Load() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// decode takes an input structure and uses reflection to translate it to
|
||||
// the output structure. output must be a pointer to a map or struct.
|
||||
func decode(input interface{}, output interface{}) error {
|
||||
cfg := &mapstructure.DecoderConfig{
|
||||
Metadata: nil,
|
||||
Result: output,
|
||||
}
|
||||
decodeOption(cfg)
|
||||
|
||||
decoder, err := mapstructure.NewDecoder(cfg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return decoder.Decode(input)
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ var (
|
||||
)
|
||||
|
||||
func (c *Config) SetDefaults() {
|
||||
c.SetDefault("hooks.enabled", true)
|
||||
c.SetDefault("auto_config.enabled", true)
|
||||
c.SetDefault("backends", DefaultBackends)
|
||||
c.SetDefault("config_sync.enabled", true)
|
||||
|
39
pkg/config/hooks.go
Normal file
39
pkg/config/hooks.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/mitchellh/mapstructure"
|
||||
)
|
||||
|
||||
type hookBase struct {
|
||||
Type string `yaml:"type"`
|
||||
}
|
||||
|
||||
func hookDecodeHook(f, t reflect.Type, data interface{}) (interface{}, error) {
|
||||
if f.Kind() != reflect.Map || t.Name() != "HookSetting" {
|
||||
return data, nil
|
||||
}
|
||||
|
||||
var base hookBase
|
||||
if err := mapstructure.Decode(data, &base); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var hook HookSetting
|
||||
switch base.Type {
|
||||
case "web":
|
||||
hook = &WebHookSetting{
|
||||
Method: "POST",
|
||||
}
|
||||
case "exec":
|
||||
hook = &ExecHookSetting{
|
||||
Stdin: true,
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown hook type: %s", base.Type)
|
||||
}
|
||||
|
||||
return hook, decode(data, hook)
|
||||
}
|
@@ -81,6 +81,21 @@ type EndpointDiscoverySettings struct {
|
||||
ICE ICESettings `yaml:"ice,omitempty"`
|
||||
}
|
||||
|
||||
type HookSetting any
|
||||
|
||||
type WebHookSetting struct {
|
||||
URL URL `yaml:"url"`
|
||||
Method string `yaml:"method"`
|
||||
Headers map[string]string `yaml:"headers"`
|
||||
}
|
||||
|
||||
type ExecHookSetting struct {
|
||||
Command string `yaml:"command"`
|
||||
Args []string `yaml:"args"`
|
||||
Env map[string]string `yaml:"env"`
|
||||
Stdin bool `yaml:"stdin"`
|
||||
}
|
||||
|
||||
type Settings struct {
|
||||
Community string `yaml:"community,omitempty"`
|
||||
WatchInterval time.Duration `yaml:"watch_interval,omitempty"`
|
||||
@@ -93,6 +108,7 @@ type Settings struct {
|
||||
ConfigSync ConfigSyncSettings `yaml:"config_sync,omitempty"`
|
||||
RouteSync RouteSyncSettings `yaml:"route_sync,omitempty"`
|
||||
HostSync HostSyncSettings `yaml:"host_sync,omitempty"`
|
||||
Hooks []HookSetting `yaml:"hooks,omitempty"`
|
||||
EndpointDisc EndpointDiscoverySettings `yaml:"endpoint_disc,omitempty"`
|
||||
}
|
||||
|
||||
|
@@ -57,6 +57,25 @@ func (u BackendURL) MarshalText() ([]byte, error) {
|
||||
return []byte(s), nil
|
||||
}
|
||||
|
||||
type URL struct {
|
||||
url.URL
|
||||
}
|
||||
|
||||
func (u *URL) UnmarshalText(text []byte) error {
|
||||
up, err := url.Parse(string(text))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
u.URL = *up
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u URL) MarshalText() ([]byte, error) {
|
||||
return []byte(u.String()), nil
|
||||
}
|
||||
|
||||
type OutputFormat string
|
||||
|
||||
const (
|
||||
|
@@ -7,6 +7,7 @@ import (
|
||||
"riasc.eu/wice/pkg/feat/autocfg"
|
||||
"riasc.eu/wice/pkg/feat/cfgsync"
|
||||
"riasc.eu/wice/pkg/feat/epdisc"
|
||||
"riasc.eu/wice/pkg/feat/hooks"
|
||||
"riasc.eu/wice/pkg/feat/hsync"
|
||||
"riasc.eu/wice/pkg/feat/pdisc"
|
||||
"riasc.eu/wice/pkg/feat/rtsync"
|
||||
@@ -48,5 +49,9 @@ func NewFeatures(w *watcher.Watcher, cfg *config.Config, c *wgctrl.Client, b sig
|
||||
feats = append(feats, pdisc.New(w, c, b, cfg.Community))
|
||||
}
|
||||
|
||||
if len(cfg.Hooks) > 0 {
|
||||
feats = append(feats, hooks.New(w, cfg, ep))
|
||||
}
|
||||
|
||||
return feats, ep
|
||||
}
|
||||
|
163
pkg/feat/hooks/exec.go
Normal file
163
pkg/feat/hooks/exec.go
Normal file
@@ -0,0 +1,163 @@
|
||||
package hooks
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"riasc.eu/wice/pkg/config"
|
||||
"riasc.eu/wice/pkg/core"
|
||||
"riasc.eu/wice/pkg/feat/epdisc"
|
||||
icex "riasc.eu/wice/pkg/feat/epdisc/ice"
|
||||
"riasc.eu/wice/pkg/wg"
|
||||
)
|
||||
|
||||
type ExecHook struct {
|
||||
*config.ExecHookSetting
|
||||
|
||||
logger *zap.Logger
|
||||
}
|
||||
|
||||
func (h *ExecHook) run(msg proto.Message, args ...string) {
|
||||
allArgs := []string{}
|
||||
allArgs = append(allArgs, h.Args...)
|
||||
allArgs = append(allArgs, args...)
|
||||
|
||||
cmd := exec.Command(h.Command, allArgs...)
|
||||
|
||||
if msg != nil && h.Stdin {
|
||||
mo := protojson.MarshalOptions{
|
||||
Multiline: true,
|
||||
Indent: " ",
|
||||
UseProtoNames: true,
|
||||
EmitUnpopulated: false,
|
||||
}
|
||||
|
||||
if buf, err := mo.Marshal(msg); err == nil {
|
||||
buf = append(buf, '\n')
|
||||
cmd.Stdin = bytes.NewReader(buf)
|
||||
}
|
||||
}
|
||||
|
||||
for key, value := range h.Env {
|
||||
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", key, value))
|
||||
}
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
h.logger.Error("Failed to invoke exec hook", zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
func (h *ExecHook) OnInterfaceAdded(i *core.Interface) {
|
||||
go h.run(i.MarshalWithPeers(nil), "added", "interface", i.Name())
|
||||
}
|
||||
|
||||
func (h *ExecHook) OnInterfaceRemoved(i *core.Interface) {
|
||||
go h.run(i.MarshalWithPeers(nil), "removed", "interface", i.Name())
|
||||
}
|
||||
|
||||
func (h *ExecHook) OnInterfaceModified(i *core.Interface, old *wg.Device, m core.InterfaceModifier) {
|
||||
im := i.MarshalWithPeers(nil)
|
||||
|
||||
if m.Is(core.InterfaceModifiedName) {
|
||||
go h.run(im, "modified", "interface", i.Name(), "name", i.Name(), old.Name)
|
||||
}
|
||||
|
||||
if m.Is(core.InterfaceModifiedType) {
|
||||
go h.run(im, "modified", "interface", i.Name(), "type", i.Type.String(), old.Type.String())
|
||||
}
|
||||
|
||||
if m.Is(core.InterfaceModifiedPrivateKey) {
|
||||
go h.run(im, "modified", "interface", i.Name(), "private-key", i.PrivateKey().String(), old.PrivateKey.String())
|
||||
}
|
||||
|
||||
if m.Is(core.InterfaceModifiedListenPort) {
|
||||
new := fmt.Sprint(i.ListenPort)
|
||||
old := fmt.Sprint(old.ListenPort)
|
||||
|
||||
go h.run(im, "modified", "interface", i.Name(), "listen-port", new, old)
|
||||
}
|
||||
|
||||
if m.Is(core.InterfaceModifiedFirewallMark) {
|
||||
new := fmt.Sprint(i.FirewallMark)
|
||||
old := fmt.Sprint(old.FirewallMark)
|
||||
|
||||
go h.run(im, "modified", "interface", i.Name(), "fwmark", new, old)
|
||||
}
|
||||
|
||||
if m.Is(core.InterfaceModifiedPeers) {
|
||||
go h.run(im, "modified", "interface", i.Name(), "peers")
|
||||
}
|
||||
}
|
||||
|
||||
func (h *ExecHook) OnPeerAdded(p *core.Peer) {
|
||||
go h.run(p.Marshal(), "added", "peer", p.Interface.Name(), p.PublicKey().String())
|
||||
}
|
||||
|
||||
func (h *ExecHook) OnPeerRemoved(p *core.Peer) {
|
||||
go h.run(p.Marshal(), "removed", "peer", p.Interface.Name(), p.PublicKey().String())
|
||||
}
|
||||
|
||||
func (h *ExecHook) OnPeerModified(p *core.Peer, old *wgtypes.Peer, m core.PeerModifier, ipsAdded, ipsRemoved []net.IPNet) {
|
||||
pm := p.Marshal()
|
||||
|
||||
if m.Is(core.PeerModifiedPresharedKey) {
|
||||
go h.run(pm, "modified", "peer", p.Interface.Name(), p.PublicKey().String(), "preshared-key", p.PresharedKey().String(), old.PresharedKey.String())
|
||||
}
|
||||
|
||||
if m.Is(core.PeerModifiedEndpoint) {
|
||||
go h.run(pm, "modified", "peer", p.Interface.Name(), p.PublicKey().String(), "endpoint", p.Endpoint.String(), old.Endpoint.String())
|
||||
}
|
||||
|
||||
if m.Is(core.PeerModifiedKeepaliveInterval) {
|
||||
new := fmt.Sprint(p.PersistentKeepaliveInterval.Seconds())
|
||||
old := fmt.Sprint(old.PersistentKeepaliveInterval.Seconds())
|
||||
|
||||
go h.run(pm, "modified", "peer", p.Interface.Name(), p.PublicKey().String(), "presistent-keepalive", new, old)
|
||||
}
|
||||
|
||||
if m.Is(core.PeerModifiedHandshakeTime) {
|
||||
new := fmt.Sprint(p.LastHandshakeTime.UnixMilli())
|
||||
old := fmt.Sprint(old.LastHandshakeTime.UnixMilli())
|
||||
|
||||
go h.run(pm, "modified", "peer", p.Interface.Name(), p.PublicKey().String(), "last-handshake", new, old)
|
||||
}
|
||||
|
||||
if m.Is(core.PeerModifiedAllowedIPs) {
|
||||
added := []string{}
|
||||
for _, ip := range ipsAdded {
|
||||
added = append(added, ip.String())
|
||||
}
|
||||
|
||||
removed := []string{}
|
||||
for _, ip := range ipsRemoved {
|
||||
removed = append(removed, ip.String())
|
||||
}
|
||||
|
||||
go h.run(pm, "modified", "peer", p.Interface.Name(), p.PublicKey().String(), "allowed-ips", strings.Join(added, ","), strings.Join(removed, ","))
|
||||
}
|
||||
|
||||
if m.Is(core.PeerModifiedProtocolVersion) {
|
||||
new := fmt.Sprint(p.ProtocolVersion)
|
||||
old := fmt.Sprint(old.ProtocolVersion)
|
||||
|
||||
go h.run(pm, "modified", "peer", p.Interface.Name(), p.PublicKey().String(), "protocol-version", new, old)
|
||||
}
|
||||
|
||||
if m.Is(core.PeerModifiedName) {
|
||||
go h.run(pm, "modified", "peer", p.Interface.Name(), p.PublicKey().String(), "name", p.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func (h *ExecHook) OnConnectionStateChange(p *epdisc.Peer, new, prev icex.ConnectionState) {
|
||||
m := p.Peer.Marshal()
|
||||
m.Ice = p.Marshal()
|
||||
|
||||
go h.run(m, "changed", "peer", "connection-state", p.Interface.Name(), p.PublicKey().String(), new.String(), prev.String())
|
||||
}
|
75
pkg/feat/hooks/hooks.go
Normal file
75
pkg/feat/hooks/hooks.go
Normal file
@@ -0,0 +1,75 @@
|
||||
package hooks
|
||||
|
||||
import (
|
||||
"go.uber.org/zap"
|
||||
"riasc.eu/wice/pkg/config"
|
||||
"riasc.eu/wice/pkg/feat/epdisc"
|
||||
"riasc.eu/wice/pkg/watcher"
|
||||
)
|
||||
|
||||
type Hooks struct {
|
||||
config *config.Config
|
||||
watcher *watcher.Watcher
|
||||
epdisc *epdisc.EndpointDiscovery
|
||||
|
||||
logger *zap.Logger
|
||||
}
|
||||
|
||||
func New(w *watcher.Watcher, cfg *config.Config, ep *epdisc.EndpointDiscovery) *Hooks {
|
||||
h := &Hooks{
|
||||
config: cfg,
|
||||
watcher: w,
|
||||
epdisc: ep,
|
||||
|
||||
logger: zap.L().Named("hooks"),
|
||||
}
|
||||
|
||||
for _, hk := range cfg.Hooks {
|
||||
switch hk := hk.(type) {
|
||||
case *config.ExecHookSetting:
|
||||
h.NewExecHook(hk)
|
||||
case *config.WebHookSetting:
|
||||
h.NewWebHook(hk)
|
||||
}
|
||||
}
|
||||
|
||||
return h
|
||||
}
|
||||
|
||||
func (h *Hooks) NewExecHook(cfg *config.ExecHookSetting) {
|
||||
hk := &ExecHook{
|
||||
ExecHookSetting: cfg,
|
||||
logger: h.logger.Named("exec").With(
|
||||
zap.String("command", cfg.Command),
|
||||
),
|
||||
}
|
||||
|
||||
h.logger.Debug("Created new exec hook", zap.Any("hook", hk))
|
||||
|
||||
h.watcher.OnAll(hk)
|
||||
h.epdisc.OnConnectionStateChange(hk)
|
||||
}
|
||||
|
||||
func (h *Hooks) NewWebHook(cfg *config.WebHookSetting) {
|
||||
hk := &WebHook{
|
||||
WebHookSetting: cfg,
|
||||
logger: h.logger.Named("web").With(
|
||||
zap.String("url", cfg.URL.String()),
|
||||
),
|
||||
}
|
||||
|
||||
h.logger.Debug("Created new web hook", zap.Any("hook", hk))
|
||||
|
||||
h.watcher.OnAll(hk)
|
||||
h.epdisc.OnConnectionStateChange(hk)
|
||||
}
|
||||
|
||||
func (h *Hooks) Start() error {
|
||||
h.logger.Info("Started hooks")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Hooks) Close() error {
|
||||
return nil
|
||||
}
|
16
pkg/feat/hooks/marshal.go
Normal file
16
pkg/feat/hooks/marshal.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package hooks
|
||||
|
||||
import (
|
||||
"riasc.eu/wice/pkg/core"
|
||||
coreproto "riasc.eu/wice/pkg/proto/core"
|
||||
)
|
||||
|
||||
func marshalRedactedInterface(i *core.Interface) *coreproto.Interface {
|
||||
return i.MarshalWithPeers(func(p *core.Peer) *coreproto.Peer {
|
||||
return p.Marshal().Redact()
|
||||
}).Redact()
|
||||
}
|
||||
|
||||
func marshalRedactedPeer(p *core.Peer) *coreproto.Peer {
|
||||
return p.Marshal().Redact()
|
||||
}
|
117
pkg/feat/hooks/web.go
Normal file
117
pkg/feat/hooks/web.go
Normal file
@@ -0,0 +1,117 @@
|
||||
package hooks
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"net"
|
||||
"net/http"
|
||||
|
||||
"go.uber.org/zap"
|
||||
"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"riasc.eu/wice/pkg/config"
|
||||
"riasc.eu/wice/pkg/core"
|
||||
"riasc.eu/wice/pkg/feat/epdisc"
|
||||
"riasc.eu/wice/pkg/util/buildinfo"
|
||||
"riasc.eu/wice/pkg/wg"
|
||||
|
||||
icex "riasc.eu/wice/pkg/feat/epdisc/ice"
|
||||
hooksproto "riasc.eu/wice/pkg/proto/feat/hooks"
|
||||
rpcproto "riasc.eu/wice/pkg/proto/rpc"
|
||||
)
|
||||
|
||||
type WebHook struct {
|
||||
*config.WebHookSetting
|
||||
|
||||
logger *zap.Logger
|
||||
}
|
||||
|
||||
func (h *WebHook) run(msg proto.Message) {
|
||||
req := &http.Request{
|
||||
Method: h.Method,
|
||||
URL: &h.URL.URL,
|
||||
Header: http.Header{},
|
||||
}
|
||||
|
||||
req.Header.Add("user-agent", buildinfo.UserAgent())
|
||||
req.Header.Add("content-type", "application/json")
|
||||
|
||||
for key, value := range h.Headers {
|
||||
req.Header.Add(key, value)
|
||||
}
|
||||
|
||||
mo := protojson.MarshalOptions{
|
||||
Multiline: true,
|
||||
Indent: " ",
|
||||
UseProtoNames: true,
|
||||
EmitUnpopulated: false,
|
||||
}
|
||||
|
||||
if buf, err := mo.Marshal(msg); err == nil {
|
||||
req.Body = io.NopCloser(bytes.NewReader(buf))
|
||||
}
|
||||
|
||||
if resp, err := http.DefaultClient.Do(req); err != nil {
|
||||
h.logger.Error("Failed to invoke web-hook", zap.Error(err))
|
||||
} else if resp.StatusCode != http.StatusOK {
|
||||
h.logger.Warn("Webhook endpoint responded with non-200 code",
|
||||
zap.String("status", resp.Status),
|
||||
zap.Int("status_code", resp.StatusCode))
|
||||
}
|
||||
}
|
||||
|
||||
func (h *WebHook) OnInterfaceAdded(i *core.Interface) {
|
||||
go h.run(&hooksproto.WebHookBody{
|
||||
Type: rpcproto.EventType_INTERFACE_ADDED,
|
||||
Interface: marshalRedactedInterface(i),
|
||||
})
|
||||
}
|
||||
|
||||
func (h *WebHook) OnInterfaceRemoved(i *core.Interface) {
|
||||
go h.run(&hooksproto.WebHookBody{
|
||||
Type: rpcproto.EventType_INTERFACE_REMOVED,
|
||||
Interface: marshalRedactedInterface(i),
|
||||
})
|
||||
}
|
||||
|
||||
func (h *WebHook) OnInterfaceModified(i *core.Interface, old *wg.Device, m core.InterfaceModifier) {
|
||||
go h.run(&hooksproto.WebHookBody{
|
||||
Type: rpcproto.EventType_INTERFACE_MODIFIED,
|
||||
Interface: marshalRedactedInterface(i),
|
||||
Modified: m.Strings(),
|
||||
})
|
||||
}
|
||||
|
||||
func (h *WebHook) OnPeerAdded(p *core.Peer) {
|
||||
go h.run(&hooksproto.WebHookBody{
|
||||
Type: rpcproto.EventType_PEER_ADDED,
|
||||
Peer: marshalRedactedPeer(p),
|
||||
})
|
||||
}
|
||||
|
||||
func (h *WebHook) OnPeerRemoved(p *core.Peer) {
|
||||
go h.run(&hooksproto.WebHookBody{
|
||||
Type: rpcproto.EventType_PEER_REMOVED,
|
||||
Peer: marshalRedactedPeer(p),
|
||||
})
|
||||
}
|
||||
|
||||
func (h *WebHook) OnPeerModified(p *core.Peer, old *wgtypes.Peer, m core.PeerModifier, ipsAdded, ipsRemoved []net.IPNet) {
|
||||
go h.run(&hooksproto.WebHookBody{
|
||||
Type: rpcproto.EventType_PEER_MODIFIED,
|
||||
Peer: marshalRedactedPeer(p),
|
||||
Modified: m.Strings(),
|
||||
})
|
||||
}
|
||||
|
||||
func (h *WebHook) OnConnectionStateChange(p *epdisc.Peer, new, prev icex.ConnectionState) {
|
||||
pm := marshalRedactedPeer(p.Peer)
|
||||
pm.Ice = p.Marshal()
|
||||
|
||||
go h.run(&hooksproto.WebHookBody{
|
||||
Type: rpcproto.EventType_PEER_CONNECTION_STATE_CHANGED,
|
||||
Peer: pm,
|
||||
})
|
||||
}
|
@@ -28,6 +28,8 @@ func (i *Interface) Device() *wg.Device {
|
||||
}
|
||||
}
|
||||
|
||||
// Dump writes a human readable version of the interface status to the supplied writer.
|
||||
// The format resembles the one used by wg(8).
|
||||
func (i *Interface) Dump(wr io.Writer, verbosity int) error {
|
||||
wri := t.NewIndenter(wr, " ")
|
||||
|
||||
@@ -93,3 +95,10 @@ func (i *Interface) Dump(wr io.Writer, verbosity int) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Redact redacts any sensitive information from the interface status such as private keys
|
||||
func (i *Interface) Redact() *Interface {
|
||||
i.PrivateKey = nil
|
||||
|
||||
return i
|
||||
}
|
||||
|
@@ -127,3 +127,10 @@ func (p *Peer) Dump(wr io.Writer, verbosity int) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Redact redacts any sensitive information from the peer status such as the preshared key
|
||||
func (p *Peer) Redact() *Peer {
|
||||
p.PresharedKey = nil
|
||||
|
||||
return p
|
||||
}
|
||||
|
188
pkg/proto/feat/hooks/hooks.pb.go
Normal file
188
pkg/proto/feat/hooks/hooks.pb.go
Normal file
@@ -0,0 +1,188 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.28.1
|
||||
// protoc v3.6.1
|
||||
// source: feat/hooks.proto
|
||||
|
||||
package hooks
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
core "riasc.eu/wice/pkg/proto/core"
|
||||
rpc "riasc.eu/wice/pkg/proto/rpc"
|
||||
sync "sync"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type WebHookBody struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Type rpc.EventType `protobuf:"varint,1,opt,name=type,proto3,enum=wice.rpc.EventType" json:"type,omitempty"`
|
||||
Interface *core.Interface `protobuf:"bytes,2,opt,name=interface,proto3" json:"interface,omitempty"`
|
||||
Peer *core.Peer `protobuf:"bytes,3,opt,name=peer,proto3" json:"peer,omitempty"`
|
||||
Modified []string `protobuf:"bytes,4,rep,name=modified,proto3" json:"modified,omitempty"`
|
||||
}
|
||||
|
||||
func (x *WebHookBody) Reset() {
|
||||
*x = WebHookBody{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_feat_hooks_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *WebHookBody) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*WebHookBody) ProtoMessage() {}
|
||||
|
||||
func (x *WebHookBody) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_feat_hooks_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use WebHookBody.ProtoReflect.Descriptor instead.
|
||||
func (*WebHookBody) Descriptor() ([]byte, []int) {
|
||||
return file_feat_hooks_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *WebHookBody) GetType() rpc.EventType {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return rpc.EventType(0)
|
||||
}
|
||||
|
||||
func (x *WebHookBody) GetInterface() *core.Interface {
|
||||
if x != nil {
|
||||
return x.Interface
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WebHookBody) GetPeer() *core.Peer {
|
||||
if x != nil {
|
||||
return x.Peer
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *WebHookBody) GetModified() []string {
|
||||
if x != nil {
|
||||
return x.Modified
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_feat_hooks_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_feat_hooks_proto_rawDesc = []byte{
|
||||
0x0a, 0x10, 0x66, 0x65, 0x61, 0x74, 0x2f, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x0a, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x1a, 0x14,
|
||||
0x63, 0x6f, 0x72, 0x65, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x63, 0x6f, 0x72, 0x65, 0x2f, 0x70, 0x65, 0x65, 0x72, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x72, 0x70, 0x63, 0x2f, 0x65, 0x76, 0x65, 0x6e, 0x74,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xab, 0x01, 0x0a, 0x0b, 0x57, 0x65, 0x62, 0x48, 0x6f,
|
||||
0x6f, 0x6b, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x27, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x13, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e,
|
||||
0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12,
|
||||
0x32, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x14, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x49,
|
||||
0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66,
|
||||
0x61, 0x63, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x0f, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x50, 0x65,
|
||||
0x65, 0x72, 0x52, 0x04, 0x70, 0x65, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6f, 0x64, 0x69,
|
||||
0x66, 0x69, 0x65, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x6d, 0x6f, 0x64, 0x69,
|
||||
0x66, 0x69, 0x65, 0x64, 0x42, 0x24, 0x5a, 0x22, 0x72, 0x69, 0x61, 0x73, 0x63, 0x2e, 0x65, 0x75,
|
||||
0x2f, 0x77, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f,
|
||||
0x66, 0x65, 0x61, 0x74, 0x2f, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_feat_hooks_proto_rawDescOnce sync.Once
|
||||
file_feat_hooks_proto_rawDescData = file_feat_hooks_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_feat_hooks_proto_rawDescGZIP() []byte {
|
||||
file_feat_hooks_proto_rawDescOnce.Do(func() {
|
||||
file_feat_hooks_proto_rawDescData = protoimpl.X.CompressGZIP(file_feat_hooks_proto_rawDescData)
|
||||
})
|
||||
return file_feat_hooks_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_feat_hooks_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_feat_hooks_proto_goTypes = []interface{}{
|
||||
(*WebHookBody)(nil), // 0: wice.hooks.WebHookBody
|
||||
(rpc.EventType)(0), // 1: wice.rpc.EventType
|
||||
(*core.Interface)(nil), // 2: wice.core.Interface
|
||||
(*core.Peer)(nil), // 3: wice.core.Peer
|
||||
}
|
||||
var file_feat_hooks_proto_depIdxs = []int32{
|
||||
1, // 0: wice.hooks.WebHookBody.type:type_name -> wice.rpc.EventType
|
||||
2, // 1: wice.hooks.WebHookBody.interface:type_name -> wice.core.Interface
|
||||
3, // 2: wice.hooks.WebHookBody.peer:type_name -> wice.core.Peer
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_feat_hooks_proto_init() }
|
||||
func file_feat_hooks_proto_init() {
|
||||
if File_feat_hooks_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_feat_hooks_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*WebHookBody); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_feat_hooks_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_feat_hooks_proto_goTypes,
|
||||
DependencyIndexes: file_feat_hooks_proto_depIdxs,
|
||||
MessageInfos: file_feat_hooks_proto_msgTypes,
|
||||
}.Build()
|
||||
File_feat_hooks_proto = out.File
|
||||
file_feat_hooks_proto_rawDesc = nil
|
||||
file_feat_hooks_proto_goTypes = nil
|
||||
file_feat_hooks_proto_depIdxs = nil
|
||||
}
|
@@ -5,7 +5,7 @@ package proto
|
||||
//go:generate protoc --proto_path=../../proto --go_out=. --go_opt=paths=import,module=riasc.eu/wice/pkg/proto core/peer.proto core/interface.proto
|
||||
//go:generate protoc --proto_path=../../proto --go_out=. --go_opt=paths=import,module=riasc.eu/wice/pkg/proto signaling/signaling.proto
|
||||
//go:generate protoc --proto_path=../../proto --go_out=. --go_opt=paths=import,module=riasc.eu/wice/pkg/proto rpc/daemon.proto rpc/epdisc.proto rpc/event.proto rpc/signaling.proto rpc/watcher.proto
|
||||
//go:generate protoc --proto_path=../../proto --go_out=. --go_opt=paths=import,module=riasc.eu/wice/pkg/proto feat/epdisc.proto feat/epdisc_candidate.proto feat/pdisc.proto feat/pske.proto
|
||||
//go:generate protoc --proto_path=../../proto --go_out=. --go_opt=paths=import,module=riasc.eu/wice/pkg/proto feat/epdisc.proto feat/epdisc_candidate.proto feat/pdisc.proto feat/pske.proto feat/hooks.proto
|
||||
|
||||
//go:generate protoc --proto_path=../../proto --go-grpc_out=. --go-grpc_opt=paths=import,module=riasc.eu/wice/pkg/proto rpc/daemon.proto rpc/epdisc.proto rpc/signaling.proto rpc/watcher.proto
|
||||
//go:generate protoc --proto_path=../../proto --go-grpc_out=. --go-grpc_opt=paths=import,module=riasc.eu/wice/pkg/proto signaling/signaling.proto
|
||||
|
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func (e *Event) Log(l *zap.Logger, msg string, fields ...zap.Field) {
|
||||
if e.Type != Event_UNKNOWN {
|
||||
if e.Type != EventType_UNKNOWN {
|
||||
fields = append(fields, zap.String("type", strings.ToLower(e.Type.String())))
|
||||
}
|
||||
|
||||
|
@@ -23,27 +23,27 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type Event_Type int32
|
||||
type EventType int32
|
||||
|
||||
const (
|
||||
Event_UNKNOWN Event_Type = 0
|
||||
EventType_UNKNOWN EventType = 0
|
||||
// Signaling Events
|
||||
Event_BACKEND_READY Event_Type = 10
|
||||
Event_SIGNALING_MESSAGE Event_Type = 11
|
||||
EventType_BACKEND_READY EventType = 10
|
||||
EventType_SIGNALING_MESSAGE EventType = 11
|
||||
// Core Events
|
||||
Event_PEER_ADDED Event_Type = 20
|
||||
Event_PEER_REMOVED Event_Type = 21
|
||||
Event_PEER_MODIFIED Event_Type = 22
|
||||
Event_INTERFACE_ADDED Event_Type = 30
|
||||
Event_INTERFACE_REMOVED Event_Type = 31
|
||||
Event_INTERFACE_MODIFIED Event_Type = 32
|
||||
EventType_PEER_ADDED EventType = 20
|
||||
EventType_PEER_REMOVED EventType = 21
|
||||
EventType_PEER_MODIFIED EventType = 22
|
||||
EventType_INTERFACE_ADDED EventType = 30
|
||||
EventType_INTERFACE_REMOVED EventType = 31
|
||||
EventType_INTERFACE_MODIFIED EventType = 32
|
||||
// ICE Events
|
||||
Event_PEER_CONNECTION_STATE_CHANGED Event_Type = 40
|
||||
EventType_PEER_CONNECTION_STATE_CHANGED EventType = 40
|
||||
)
|
||||
|
||||
// Enum value maps for Event_Type.
|
||||
// Enum value maps for EventType.
|
||||
var (
|
||||
Event_Type_name = map[int32]string{
|
||||
EventType_name = map[int32]string{
|
||||
0: "UNKNOWN",
|
||||
10: "BACKEND_READY",
|
||||
11: "SIGNALING_MESSAGE",
|
||||
@@ -55,7 +55,7 @@ var (
|
||||
32: "INTERFACE_MODIFIED",
|
||||
40: "PEER_CONNECTION_STATE_CHANGED",
|
||||
}
|
||||
Event_Type_value = map[string]int32{
|
||||
EventType_value = map[string]int32{
|
||||
"UNKNOWN": 0,
|
||||
"BACKEND_READY": 10,
|
||||
"SIGNALING_MESSAGE": 11,
|
||||
@@ -69,31 +69,31 @@ var (
|
||||
}
|
||||
)
|
||||
|
||||
func (x Event_Type) Enum() *Event_Type {
|
||||
p := new(Event_Type)
|
||||
func (x EventType) Enum() *EventType {
|
||||
p := new(EventType)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x Event_Type) String() string {
|
||||
func (x EventType) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (Event_Type) Descriptor() protoreflect.EnumDescriptor {
|
||||
func (EventType) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_rpc_event_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (Event_Type) Type() protoreflect.EnumType {
|
||||
func (EventType) Type() protoreflect.EnumType {
|
||||
return &file_rpc_event_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x Event_Type) Number() protoreflect.EnumNumber {
|
||||
func (x EventType) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Event_Type.Descriptor instead.
|
||||
func (Event_Type) EnumDescriptor() ([]byte, []int) {
|
||||
return file_rpc_event_proto_rawDescGZIP(), []int{0, 0}
|
||||
// Deprecated: Use EventType.Descriptor instead.
|
||||
func (EventType) EnumDescriptor() ([]byte, []int) {
|
||||
return file_rpc_event_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
type Event struct {
|
||||
@@ -101,7 +101,7 @@ type Event struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Type Event_Type `protobuf:"varint,1,opt,name=type,proto3,enum=wice.rpc.Event_Type" json:"type,omitempty"`
|
||||
Type EventType `protobuf:"varint,1,opt,name=type,proto3,enum=wice.rpc.EventType" json:"type,omitempty"`
|
||||
Time *proto.Timestamp `protobuf:"bytes,2,opt,name=time,proto3" json:"time,omitempty"`
|
||||
// Public key of peer which triggerd the event
|
||||
Peer []byte `protobuf:"bytes,3,opt,name=peer,proto3" json:"peer,omitempty"`
|
||||
@@ -148,11 +148,11 @@ func (*Event) Descriptor() ([]byte, []int) {
|
||||
return file_rpc_event_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Event) GetType() Event_Type {
|
||||
func (x *Event) GetType() EventType {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return Event_UNKNOWN
|
||||
return EventType_UNKNOWN
|
||||
}
|
||||
|
||||
func (x *Event) GetTime() *proto.Timestamp {
|
||||
@@ -443,74 +443,75 @@ var file_rpc_event_proto_rawDesc = []byte{
|
||||
0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x73, 0x69, 0x67, 0x6e, 0x61,
|
||||
0x6c, 0x69, 0x6e, 0x67, 0x2f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x11, 0x66, 0x65, 0x61, 0x74, 0x2f, 0x65, 0x70, 0x64, 0x69, 0x73,
|
||||
0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbe, 0x05, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e,
|
||||
0x74, 0x12, 0x28, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,
|
||||
0x14, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74,
|
||||
0x2e, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x74,
|
||||
0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x77, 0x69, 0x63, 0x65,
|
||||
0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04,
|
||||
0x70, 0x65, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63,
|
||||
0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61,
|
||||
0x63, 0x65, 0x12, 0x4b, 0x0a, 0x0d, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65,
|
||||
0x61, 0x64, 0x79, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x77, 0x69, 0x63, 0x65,
|
||||
0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x42, 0x61,
|
||||
0x63, 0x6b, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x61, 0x64, 0x79, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48,
|
||||
0x00, 0x52, 0x0c, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x61, 0x64, 0x79, 0x12,
|
||||
0x6b, 0x0a, 0x1c, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18,
|
||||
0x79, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x72, 0x70, 0x63,
|
||||
0x2e, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53,
|
||||
0x74, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48,
|
||||
0x00, 0x52, 0x19, 0x70, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x42, 0x0a, 0x0d,
|
||||
0x70, 0x65, 0x65, 0x72, 0x5f, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x7a, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x50,
|
||||
0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe1, 0x03, 0x0a, 0x05, 0x45, 0x76, 0x65, 0x6e,
|
||||
0x74, 0x12, 0x27, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,
|
||||
0x13, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74,
|
||||
0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x23, 0x0a, 0x04, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e,
|
||||
0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x04, 0x74, 0x69, 0x6d, 0x65, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x70, 0x65, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x70,
|
||||
0x65, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63,
|
||||
0x65, 0x12, 0x4b, 0x0a, 0x0d, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x5f, 0x72, 0x65, 0x61,
|
||||
0x64, 0x79, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e,
|
||||
0x72, 0x70, 0x63, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x42, 0x61, 0x63,
|
||||
0x6b, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x61, 0x64, 0x79, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00,
|
||||
0x52, 0x0c, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x61, 0x64, 0x79, 0x12, 0x6b,
|
||||
0x0a, 0x1c, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x79,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e,
|
||||
0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74,
|
||||
0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00,
|
||||
0x52, 0x19, 0x70, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x42, 0x0a, 0x0d, 0x70,
|
||||
0x65, 0x65, 0x72, 0x5f, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x7a, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x65,
|
||||
0x65, 0x72, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48,
|
||||
0x00, 0x52, 0x0c, 0x70, 0x65, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x12,
|
||||
0x51, 0x0a, 0x12, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x5f, 0x6d, 0x6f, 0x64,
|
||||
0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x7b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x77, 0x69,
|
||||
0x63, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65,
|
||||
0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00, 0x52,
|
||||
0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69,
|
||||
0x65, 0x64, 0x42, 0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x2f, 0x0a, 0x11, 0x50,
|
||||
0x65, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74,
|
||||
0x48, 0x00, 0x52, 0x0c, 0x70, 0x65, 0x65, 0x72, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64,
|
||||
0x12, 0x51, 0x0a, 0x12, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x5f, 0x6d, 0x6f,
|
||||
0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x7b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x77,
|
||||
0x69, 0x63, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63,
|
||||
0x65, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x48, 0x00,
|
||||
0x52, 0x11, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x4d, 0x6f, 0x64, 0x69, 0x66,
|
||||
0x69, 0x65, 0x64, 0x22, 0xd9, 0x01, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07,
|
||||
0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x42, 0x41, 0x43,
|
||||
0x4b, 0x45, 0x4e, 0x44, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x0a, 0x12, 0x15, 0x0a, 0x11,
|
||||
0x53, 0x49, 0x47, 0x4e, 0x41, 0x4c, 0x49, 0x4e, 0x47, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47,
|
||||
0x45, 0x10, 0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x45, 0x45, 0x52, 0x5f, 0x41, 0x44, 0x44, 0x45,
|
||||
0x44, 0x10, 0x14, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x45, 0x45, 0x52, 0x5f, 0x52, 0x45, 0x4d, 0x4f,
|
||||
0x56, 0x45, 0x44, 0x10, 0x15, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x45, 0x45, 0x52, 0x5f, 0x4d, 0x4f,
|
||||
0x44, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x16, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x4e, 0x54, 0x45,
|
||||
0x52, 0x46, 0x41, 0x43, 0x45, 0x5f, 0x41, 0x44, 0x44, 0x45, 0x44, 0x10, 0x1e, 0x12, 0x15, 0x0a,
|
||||
0x11, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x46, 0x41, 0x43, 0x45, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56,
|
||||
0x45, 0x44, 0x10, 0x1f, 0x12, 0x16, 0x0a, 0x12, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x46, 0x41, 0x43,
|
||||
0x45, 0x5f, 0x4d, 0x4f, 0x44, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x20, 0x12, 0x21, 0x0a, 0x1d,
|
||||
0x50, 0x45, 0x45, 0x52, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f,
|
||||
0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x44, 0x10, 0x28, 0x42,
|
||||
0x07, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x22, 0x2f, 0x0a, 0x11, 0x50, 0x65, 0x65, 0x72,
|
||||
0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
|
||||
0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x22, 0x34, 0x0a, 0x16, 0x49, 0x6e, 0x74,
|
||||
0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x45, 0x76,
|
||||
0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x22,
|
||||
0x98, 0x01, 0x0a, 0x1e, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x45, 0x76, 0x65,
|
||||
0x6e, 0x74, 0x12, 0x39, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x65, 0x70, 0x64,
|
||||
0x69, 0x73, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74,
|
||||
0x61, 0x74, 0x65, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3b, 0x0a,
|
||||
0x0a, 0x70, 0x72, 0x65, 0x76, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x0e, 0x32, 0x1c, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x65, 0x70, 0x64, 0x69, 0x73, 0x63, 0x2e,
|
||||
0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52,
|
||||
0x09, 0x70, 0x72, 0x65, 0x76, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x4d, 0x0a, 0x1a, 0x53, 0x69,
|
||||
0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x52, 0x65,
|
||||
0x61, 0x64, 0x79, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x73, 0x69,
|
||||
0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x54,
|
||||
0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x42, 0x1d, 0x5a, 0x1b, 0x72, 0x69, 0x61,
|
||||
0x73, 0x63, 0x2e, 0x65, 0x75, 0x2f, 0x77, 0x69, 0x63, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0d, 0x52, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65, 0x64, 0x22, 0x34, 0x0a, 0x16,
|
||||
0x49, 0x6e, 0x74, 0x65, 0x72, 0x66, 0x61, 0x63, 0x65, 0x4d, 0x6f, 0x64, 0x69, 0x66, 0x69, 0x65,
|
||||
0x64, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69,
|
||||
0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6d, 0x6f, 0x64, 0x69, 0x66, 0x69,
|
||||
0x65, 0x64, 0x22, 0x98, 0x01, 0x0a, 0x1e, 0x50, 0x65, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x6e, 0x65,
|
||||
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65,
|
||||
0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x39, 0x0a, 0x09, 0x6e, 0x65, 0x77, 0x5f, 0x73, 0x74, 0x61,
|
||||
0x74, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e,
|
||||
0x65, 0x70, 0x64, 0x69, 0x73, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x08, 0x6e, 0x65, 0x77, 0x53, 0x74, 0x61, 0x74, 0x65,
|
||||
0x12, 0x3b, 0x0a, 0x0a, 0x70, 0x72, 0x65, 0x76, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x0e, 0x32, 0x1c, 0x2e, 0x77, 0x69, 0x63, 0x65, 0x2e, 0x65, 0x70, 0x64, 0x69,
|
||||
0x73, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
|
||||
0x74, 0x65, 0x52, 0x09, 0x70, 0x72, 0x65, 0x76, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x4d, 0x0a,
|
||||
0x1a, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x42, 0x61, 0x63, 0x6b, 0x65, 0x6e,
|
||||
0x64, 0x52, 0x65, 0x61, 0x64, 0x79, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x04, 0x74,
|
||||
0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x77, 0x69, 0x63, 0x65,
|
||||
0x2e, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x69, 0x6e, 0x67, 0x2e, 0x42, 0x61, 0x63, 0x6b, 0x65,
|
||||
0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x2a, 0xde, 0x01, 0x0a,
|
||||
0x09, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e,
|
||||
0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x42, 0x41, 0x43, 0x4b, 0x45,
|
||||
0x4e, 0x44, 0x5f, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x0a, 0x12, 0x15, 0x0a, 0x11, 0x53, 0x49,
|
||||
0x47, 0x4e, 0x41, 0x4c, 0x49, 0x4e, 0x47, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x10,
|
||||
0x0b, 0x12, 0x0e, 0x0a, 0x0a, 0x50, 0x45, 0x45, 0x52, 0x5f, 0x41, 0x44, 0x44, 0x45, 0x44, 0x10,
|
||||
0x14, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x45, 0x45, 0x52, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45,
|
||||
0x44, 0x10, 0x15, 0x12, 0x11, 0x0a, 0x0d, 0x50, 0x45, 0x45, 0x52, 0x5f, 0x4d, 0x4f, 0x44, 0x49,
|
||||
0x46, 0x49, 0x45, 0x44, 0x10, 0x16, 0x12, 0x13, 0x0a, 0x0f, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x46,
|
||||
0x41, 0x43, 0x45, 0x5f, 0x41, 0x44, 0x44, 0x45, 0x44, 0x10, 0x1e, 0x12, 0x15, 0x0a, 0x11, 0x49,
|
||||
0x4e, 0x54, 0x45, 0x52, 0x46, 0x41, 0x43, 0x45, 0x5f, 0x52, 0x45, 0x4d, 0x4f, 0x56, 0x45, 0x44,
|
||||
0x10, 0x1f, 0x12, 0x16, 0x0a, 0x12, 0x49, 0x4e, 0x54, 0x45, 0x52, 0x46, 0x41, 0x43, 0x45, 0x5f,
|
||||
0x4d, 0x4f, 0x44, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x20, 0x12, 0x21, 0x0a, 0x1d, 0x50, 0x45,
|
||||
0x45, 0x52, 0x5f, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54,
|
||||
0x41, 0x54, 0x45, 0x5f, 0x43, 0x48, 0x41, 0x4e, 0x47, 0x45, 0x44, 0x10, 0x28, 0x42, 0x1d, 0x5a,
|
||||
0x1b, 0x72, 0x69, 0x61, 0x73, 0x63, 0x2e, 0x65, 0x75, 0x2f, 0x77, 0x69, 0x63, 0x65, 0x2f, 0x70,
|
||||
0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -528,7 +529,7 @@ func file_rpc_event_proto_rawDescGZIP() []byte {
|
||||
var file_rpc_event_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_rpc_event_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_rpc_event_proto_goTypes = []interface{}{
|
||||
(Event_Type)(0), // 0: wice.rpc.Event.Type
|
||||
(EventType)(0), // 0: wice.rpc.EventType
|
||||
(*Event)(nil), // 1: wice.rpc.Event
|
||||
(*PeerModifiedEvent)(nil), // 2: wice.rpc.PeerModifiedEvent
|
||||
(*InterfaceModifiedEvent)(nil), // 3: wice.rpc.InterfaceModifiedEvent
|
||||
@@ -539,7 +540,7 @@ var file_rpc_event_proto_goTypes = []interface{}{
|
||||
(signaling.BackendType)(0), // 8: wice.signaling.BackendType
|
||||
}
|
||||
var file_rpc_event_proto_depIdxs = []int32{
|
||||
0, // 0: wice.rpc.Event.type:type_name -> wice.rpc.Event.Type
|
||||
0, // 0: wice.rpc.Event.type:type_name -> wice.rpc.EventType
|
||||
6, // 1: wice.rpc.Event.time:type_name -> wice.Timestamp
|
||||
5, // 2: wice.rpc.Event.backend_ready:type_name -> wice.rpc.SignalingBackendReadyEvent
|
||||
4, // 3: wice.rpc.Event.peer_connection_state_change:type_name -> wice.rpc.PeerConnectionStateChangeEvent
|
||||
|
@@ -127,7 +127,7 @@ func (c *Client) streamEvents() {
|
||||
break
|
||||
}
|
||||
|
||||
if e.Type == rpcproto.Event_PEER_CONNECTION_STATE_CHANGED {
|
||||
if e.Type == rpcproto.EventType_PEER_CONNECTION_STATE_CHANGED {
|
||||
if pcs, ok := e.Event.(*rpcproto.Event_PeerConnectionStateChange); ok {
|
||||
pk, err := crypto.ParseKeyBytes(e.Peer)
|
||||
if err != nil {
|
||||
@@ -148,7 +148,7 @@ func (c *Client) streamEvents() {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Client) WaitForEvent(ctx context.Context, t rpcproto.Event_Type, intf string, peer crypto.Key) (*rpcproto.Event, error) {
|
||||
func (c *Client) WaitForEvent(ctx context.Context, t rpcproto.EventType, intf string, peer crypto.Key) (*rpcproto.Event, error) {
|
||||
for {
|
||||
select {
|
||||
case e, ok := <-c.Events:
|
||||
@@ -178,7 +178,7 @@ func (c *Client) WaitForEvent(ctx context.Context, t rpcproto.Event_Type, intf s
|
||||
|
||||
func (c *Client) WaitForPeerHandshake(ctx context.Context, peer crypto.Key) error {
|
||||
for {
|
||||
e, err := c.WaitForEvent(ctx, rpcproto.Event_PEER_MODIFIED, "", peer)
|
||||
e, err := c.WaitForEvent(ctx, rpcproto.EventType_PEER_MODIFIED, "", peer)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -15,21 +15,21 @@ import (
|
||||
|
||||
func (s *Server) OnInterfaceAdded(i *core.Interface) {
|
||||
s.events.Send(&rpcproto.Event{
|
||||
Type: rpcproto.Event_INTERFACE_ADDED,
|
||||
Type: rpcproto.EventType_INTERFACE_ADDED,
|
||||
Interface: i.Name(),
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) OnInterfaceRemoved(i *core.Interface) {
|
||||
s.events.Send(&rpcproto.Event{
|
||||
Type: rpcproto.Event_INTERFACE_REMOVED,
|
||||
Type: rpcproto.EventType_INTERFACE_REMOVED,
|
||||
Interface: i.Name(),
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Server) OnInterfaceModified(i *core.Interface, old *wg.Device, mod core.InterfaceModifier) {
|
||||
s.events.Send(&rpcproto.Event{
|
||||
Type: rpcproto.Event_INTERFACE_MODIFIED,
|
||||
Type: rpcproto.EventType_INTERFACE_MODIFIED,
|
||||
Interface: i.Name(),
|
||||
Event: &rpcproto.Event_InterfaceModified{
|
||||
InterfaceModified: &rpcproto.InterfaceModifiedEvent{
|
||||
@@ -41,7 +41,7 @@ func (s *Server) OnInterfaceModified(i *core.Interface, old *wg.Device, mod core
|
||||
|
||||
func (s *Server) OnPeerAdded(p *core.Peer) {
|
||||
s.events.Send(&rpcproto.Event{
|
||||
Type: rpcproto.Event_PEER_ADDED,
|
||||
Type: rpcproto.EventType_PEER_ADDED,
|
||||
Interface: p.Interface.Name(),
|
||||
Peer: p.PublicKey().Bytes(),
|
||||
})
|
||||
@@ -49,7 +49,7 @@ func (s *Server) OnPeerAdded(p *core.Peer) {
|
||||
|
||||
func (s *Server) OnPeerRemoved(p *core.Peer) {
|
||||
s.events.Send(&rpcproto.Event{
|
||||
Type: rpcproto.Event_PEER_REMOVED,
|
||||
Type: rpcproto.EventType_PEER_REMOVED,
|
||||
Interface: p.Interface.Name(),
|
||||
Peer: p.PublicKey().Bytes(),
|
||||
})
|
||||
@@ -57,7 +57,7 @@ func (s *Server) OnPeerRemoved(p *core.Peer) {
|
||||
|
||||
func (s *Server) OnPeerModified(p *core.Peer, old *wgtypes.Peer, mod core.PeerModifier, ipsAdded, ipsRemoved []net.IPNet) {
|
||||
s.events.Send(&rpcproto.Event{
|
||||
Type: rpcproto.Event_PEER_MODIFIED,
|
||||
Type: rpcproto.EventType_PEER_MODIFIED,
|
||||
Interface: p.Interface.Name(),
|
||||
Peer: p.PublicKey().Bytes(),
|
||||
|
||||
@@ -71,7 +71,7 @@ func (s *Server) OnPeerModified(p *core.Peer, old *wgtypes.Peer, mod core.PeerMo
|
||||
|
||||
func (s *Server) OnSignalingBackendReady(b signaling.Backend) {
|
||||
s.events.Send(&rpcproto.Event{
|
||||
Type: rpcproto.Event_BACKEND_READY,
|
||||
Type: rpcproto.EventType_BACKEND_READY,
|
||||
|
||||
Event: &rpcproto.Event_BackendReady{
|
||||
BackendReady: &rpcproto.SignalingBackendReadyEvent{
|
||||
|
@@ -63,7 +63,7 @@ func (s *EndpointDiscoveryServer) RestartPeer(ctx context.Context, params *rpcpr
|
||||
func (s *EndpointDiscoveryServer) SendConnectionStates(stream rpcproto.Daemon_StreamEventsServer) {
|
||||
for _, p := range s.Peers {
|
||||
e := &rpcproto.Event{
|
||||
Type: rpcproto.Event_PEER_CONNECTION_STATE_CHANGED,
|
||||
Type: rpcproto.EventType_PEER_CONNECTION_STATE_CHANGED,
|
||||
Interface: p.Interface.Name(),
|
||||
Peer: p.Peer.PublicKey().Bytes(),
|
||||
Event: &rpcproto.Event_PeerConnectionStateChange{
|
||||
@@ -83,7 +83,7 @@ func (s *EndpointDiscoveryServer) SendConnectionStates(stream rpcproto.Daemon_St
|
||||
|
||||
func (s *EndpointDiscoveryServer) OnConnectionStateChange(p *epdisc.Peer, new, prev icex.ConnectionState) {
|
||||
s.events.Send(&rpcproto.Event{
|
||||
Type: rpcproto.Event_PEER_CONNECTION_STATE_CHANGED,
|
||||
Type: rpcproto.EventType_PEER_CONNECTION_STATE_CHANGED,
|
||||
|
||||
Interface: p.Interface.Name(),
|
||||
Peer: p.PublicKey().Bytes(),
|
||||
|
17
proto/feat/hooks.proto
Normal file
17
proto/feat/hooks.proto
Normal file
@@ -0,0 +1,17 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package wice.hooks;
|
||||
option go_package = "riasc.eu/wice/pkg/proto/feat/hooks";
|
||||
|
||||
import "core/interface.proto";
|
||||
import "core/peer.proto";
|
||||
import "rpc/event.proto";
|
||||
|
||||
message WebHookBody {
|
||||
rpc.EventType type = 1;
|
||||
|
||||
core.Interface interface = 2;
|
||||
core.Peer peer = 3;
|
||||
|
||||
repeated string modified = 4;
|
||||
}
|
@@ -7,28 +7,28 @@ import "common.proto";
|
||||
import "signaling/signaling.proto";
|
||||
import "feat/epdisc.proto";
|
||||
|
||||
enum EventType {
|
||||
UNKNOWN = 0;
|
||||
|
||||
// Signaling Events
|
||||
BACKEND_READY = 10;
|
||||
SIGNALING_MESSAGE = 11;
|
||||
|
||||
// Core Events
|
||||
PEER_ADDED = 20;
|
||||
PEER_REMOVED = 21;
|
||||
PEER_MODIFIED = 22;
|
||||
|
||||
INTERFACE_ADDED = 30;
|
||||
INTERFACE_REMOVED = 31;
|
||||
INTERFACE_MODIFIED = 32;
|
||||
|
||||
// ICE Events
|
||||
PEER_CONNECTION_STATE_CHANGED = 40;
|
||||
}
|
||||
|
||||
message Event {
|
||||
enum Type {
|
||||
UNKNOWN = 0;
|
||||
|
||||
// Signaling Events
|
||||
BACKEND_READY = 10;
|
||||
SIGNALING_MESSAGE = 11;
|
||||
|
||||
// Core Events
|
||||
PEER_ADDED = 20;
|
||||
PEER_REMOVED = 21;
|
||||
PEER_MODIFIED = 22;
|
||||
|
||||
INTERFACE_ADDED = 30;
|
||||
INTERFACE_REMOVED = 31;
|
||||
INTERFACE_MODIFIED = 32;
|
||||
|
||||
// ICE Events
|
||||
PEER_CONNECTION_STATE_CHANGED = 40;
|
||||
}
|
||||
|
||||
Type type = 1;
|
||||
EventType type = 1;
|
||||
Timestamp time = 2;
|
||||
|
||||
// Public key of peer which triggerd the event
|
||||
|
@@ -168,7 +168,7 @@ func (a *Agent) Close() error {
|
||||
}
|
||||
|
||||
func (a *Agent) WaitBackendReady(ctx context.Context) error {
|
||||
_, err := a.Client.WaitForEvent(ctx, rpcproto.Event_BACKEND_READY, "", crypto.Key{})
|
||||
_, err := a.Client.WaitForEvent(ctx, rpcproto.EventType_BACKEND_READY, "", crypto.Key{})
|
||||
|
||||
return err
|
||||
}
|
||||
|
Reference in New Issue
Block a user