-
Couldn't load subscription status.
- Fork 0
feat: envoy control plane #100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
05d7fec
9dd6a59
3462887
0a2711c
0563da7
d952af2
a629493
85b7732
a7390e1
8b8e742
e47c71d
b2e804a
8969b28
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,20 @@ | ||
| package proxy | ||
|
|
||
| import "time" | ||
|
|
||
| type ServicesConfig struct { | ||
| Services []Config `yaml:"services" mapstructure:"services"` | ||
| EnvoyAgent EnvoyAgent `yaml:"envoy" mapstructure:"envoy"` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's update the config in https://github.com/goto/shield/blob/main/config/config.yaml with the example on how to use this envoy agent? |
||
| Services []Config `yaml:"services" mapstructure:"services"` | ||
| } | ||
|
|
||
| type EnvoyAgent struct { | ||
| XDS XDS `yaml:"xds" mapstructure:"xds"` | ||
| } | ||
|
|
||
| type XDS struct { | ||
| Host string `yaml:"host" mapstructure:"host"` | ||
| Port int `yaml:"port" mapstructure:"port"` | ||
| RefreshInterval time.Duration `yaml:"refresh_interval" mapstructure:"refresh_interval" default:"60s"` | ||
| } | ||
|
|
||
| type Config struct { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package ads | ||
|
|
||
| import ( | ||
| "context" | ||
| "time" | ||
|
|
||
| "github.com/goto/shield/core/rule" | ||
| ) | ||
|
|
||
| const ( | ||
| CLUSTER_TYPE_URL = "type.googleapis.com/envoy.config.cluster.v3.Cluster" | ||
|
||
| LISTENER_TYPE_URL = "type.googleapis.com/envoy.config.listener.v3.Listener" | ||
| ROUTE_CONFIGURATION_TYPE_URL = "type.googleapis.com/envoy.config.route.v3.RouteConfiguration" | ||
|
|
||
| HTTP_CONNECTION_MANAGER_TYPE_URL = "type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager" | ||
| ROUTER_TYPE_URL = "type.googleapis.com/envoy.extensions.filters.http.router.v3.Router" | ||
| URI_TEMPLATE_TYPE_URL = "type.googleapis.com/envoy.extensions.path.match.uri_template.v3.UriTemplateMatchConfig" | ||
| STDOUT_LOGGER_TYPE_URL = "type.googleapis.com/envoy.extensions.access_loggers.stream.v3.StdoutAccessLog" | ||
| ) | ||
|
|
||
| type Repository interface { | ||
| GetAll(ctx context.Context) ([]rule.Ruleset, error) | ||
| IsUpdated(ctx context.Context, since time.Time) bool | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package ads | ||
|
|
||
| import "errors" | ||
|
|
||
| type Message struct { | ||
| NodeID string | ||
| VersionInfo string | ||
| Nonce string | ||
| } | ||
|
|
||
| type MessageChan chan Message | ||
|
|
||
| var ( | ||
| ErrChannelClosed = errors.New("can't send message on closed channel") | ||
| ) | ||
|
|
||
| func (m MessageChan) Push(message Message) (err error) { | ||
| defer func() { | ||
| if recover() != nil { | ||
| err = ErrChannelClosed | ||
| } | ||
| }() | ||
|
|
||
| m <- message | ||
| return nil | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.