Its working

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben
2020-01-15 16:37:18 +01:00
parent cf478b0aed
commit 5f2d5788b0
23 changed files with 177 additions and 3673 deletions

View File

@@ -1,14 +1,12 @@
package traffic
import (
"fmt"
"math/rand"
"time"
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/plugin"
clog "github.com/coredns/coredns/plugin/pkg/log"
"github.com/coredns/coredns/plugin/traffic/xds"
"github.com/caddyserver/caddy"
)
@@ -33,8 +31,19 @@ func setup(c *caddy.Controller) error {
return t
})
t.c.WatchCluster("", func(x xds.CDSUpdate, _ error) { fmt.Printf("CDSUpdate: %+v\n", x) })
t.c.WatchEndpoints("", func(x *xds.EDSUpdate, _ error) { fmt.Printf("EDSUpdate: %+v\n", x) })
stream, err := t.c.Run()
if err != nil {
return plugin.Error("traffic", err)
}
if err := t.c.ClusterDiscovery(stream, "", "", []string{}); err != nil {
log.Error(err)
}
err = t.c.Receive(stream)
if err != nil {
return plugin.Error("traffic", err)
}
return nil
}