diff --git a/cmd/mesh/main.go b/cmd/mesh/main.go index 1236ccb5..8a534349 100644 --- a/cmd/mesh/main.go +++ b/cmd/mesh/main.go @@ -8,7 +8,7 @@ import ( serverv3 "github.com/envoyproxy/go-control-plane/pkg/server/v3" log "github.com/sirupsen/logrus" - "github.com/wencaiwulue/kubevpn/pkg/control_plane" + "github.com/wencaiwulue/kubevpn/pkg/controlplane" "github.com/wencaiwulue/kubevpn/pkg/util" ) @@ -29,22 +29,22 @@ func init() { func main() { snapshotCache := cache.NewSnapshotCache(false, cache.IDHash{}, logger) - proc := control_plane.NewProcessor(snapshotCache, logger) + proc := controlplane.NewProcessor(snapshotCache, logger) go func() { ctx := context.Background() server := serverv3.NewServer(ctx, snapshotCache, nil) - control_plane.RunServer(ctx, server, port) + controlplane.RunServer(ctx, server, port) }() - notifyCh := make(chan control_plane.NotifyMessage, 100) + notifyCh := make(chan controlplane.NotifyMessage, 100) - notifyCh <- control_plane.NotifyMessage{ - Operation: control_plane.Create, + notifyCh <- controlplane.NotifyMessage{ + Operation: controlplane.Create, FilePath: watchDirectoryFileName, } - go control_plane.Watch(watchDirectoryFileName, notifyCh) + go controlplane.Watch(watchDirectoryFileName, notifyCh) for { select { diff --git a/pkg/control_plane/cache.go b/pkg/controlplane/cache.go similarity index 99% rename from pkg/control_plane/cache.go rename to pkg/controlplane/cache.go index 75a5aa18..f7cf6c56 100644 --- a/pkg/control_plane/cache.go +++ b/pkg/controlplane/cache.go @@ -1,4 +1,4 @@ -package control_plane +package controlplane import ( "fmt" diff --git a/pkg/control_plane/processor.go b/pkg/controlplane/processor.go similarity index 99% rename from pkg/control_plane/processor.go rename to pkg/controlplane/processor.go index ae67af38..469178ab 100644 --- a/pkg/control_plane/processor.go +++ b/pkg/controlplane/processor.go @@ -1,4 +1,4 @@ -package control_plane +package controlplane import ( "context" diff --git a/pkg/control_plane/server.go b/pkg/controlplane/server.go similarity index 98% rename from pkg/control_plane/server.go rename to pkg/controlplane/server.go index 70d2ecc9..6b8cff47 100644 --- a/pkg/control_plane/server.go +++ b/pkg/controlplane/server.go @@ -1,11 +1,11 @@ -package control_plane +package controlplane import ( "context" "fmt" "log" "net" - + clusterservice "github.com/envoyproxy/go-control-plane/envoy/service/cluster/v3" discoverygrpc "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3" endpointservice "github.com/envoyproxy/go-control-plane/envoy/service/endpoint/v3" diff --git a/pkg/control_plane/watcher.go b/pkg/controlplane/watcher.go similarity index 98% rename from pkg/control_plane/watcher.go rename to pkg/controlplane/watcher.go index 0aa5446f..0c238141 100644 --- a/pkg/control_plane/watcher.go +++ b/pkg/controlplane/watcher.go @@ -1,4 +1,4 @@ -package control_plane +package controlplane import ( "log" diff --git a/pkg/handler/envoy.go b/pkg/handler/envoy.go index d470d8bd..9cba1cb9 100644 --- a/pkg/handler/envoy.go +++ b/pkg/handler/envoy.go @@ -21,7 +21,7 @@ import ( "sigs.k8s.io/yaml" "github.com/wencaiwulue/kubevpn/pkg/config" - "github.com/wencaiwulue/kubevpn/pkg/control_plane" + "github.com/wencaiwulue/kubevpn/pkg/controlplane" "github.com/wencaiwulue/kubevpn/pkg/mesh" "github.com/wencaiwulue/kubevpn/pkg/util" ) @@ -160,7 +160,7 @@ func addEnvoyConfig(mapInterface v12.ConfigMapInterface, nodeID string, localTUN if err != nil { return err } - var v = make([]*control_plane.Virtual, 0) + var v = make([]*controlplane.Virtual, 0) if str, ok := configMap.Data[config.Envoy]; ok { if err = yaml.Unmarshal([]byte(str), &v); err != nil { return err @@ -174,16 +174,16 @@ func addEnvoyConfig(mapInterface v12.ConfigMapInterface, nodeID string, localTUN } } if index < 0 { - v = append(v, &control_plane.Virtual{ + v = append(v, &controlplane.Virtual{ Uid: nodeID, Ports: port, - Rules: []*control_plane.Rule{{ + Rules: []*controlplane.Rule{{ Headers: headers, LocalTunIP: localTUNIP, }}, }) } else { - v[index].Rules = append(v[index].Rules, &control_plane.Rule{ + v[index].Rules = append(v[index].Rules, &controlplane.Rule{ Headers: headers, LocalTunIP: localTUNIP, }) @@ -210,7 +210,7 @@ func removeEnvoyConfig(mapInterface v12.ConfigMapInterface, nodeID string, heade if !ok { return errors.New("can not found value for key: envoy-config.yaml") } - var v []*control_plane.Virtual + var v []*controlplane.Virtual if err = yaml.Unmarshal([]byte(str), &v); err != nil { return err }