Skip to content

Commit

Permalink
add UserAgentFilter struct
Browse files Browse the repository at this point in the history
  • Loading branch information
Megalonia committed Sep 7, 2023
1 parent 19f0184 commit 2be01b2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/v1alpha1/httpsedge_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ type HTTPSEdgeRouteSpec struct {

// WebhookVerification is webhook verification configuration to apply to this route
WebhookVerification *EndpointWebhookVerification `json:"webhookVerification,omitempty"`

// UserAgentFilter is the User Agent filter configuration to apply to this route
UserAgentFilter *EndpointUserAgentFilter `json:"userAgentFilter,omitempty"`
}

// HTTPSEdgeSpec defines the desired state of HTTPSEdge
Expand Down
7 changes: 7 additions & 0 deletions api/v1alpha1/ngrok_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ type ngrokAPICommon struct {

// Route Module Types

type EndpointUserAgentFilter struct {
// a list of regexular expressions that will be used to allow traffic from HTTP Requests
Allow []string `json:"allow,omitempty"`
// a list of regexular expressions that will be used to deny traffic from HTTP Requests
Deny []string `json:"deny,omitempty"`
}

type EndpointCompression struct {
// Enabled is whether or not to enable compression for this endpoint
Enabled bool `json:"enabled,omitempty"`
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/ngrokmoduleset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ type NgrokModuleSetModules struct {
TLSTermination *EndpointTLSTerminationAtEdge `json:"tlsTermination,omitempty"`
// WebhookVerification configuration for this module set
WebhookVerification *EndpointWebhookVerification `json:"webhookVerification,omitempty"`
// UserAgentFilter configuration for this module set
UserAgentFilter *EndpointUserAgentFilter `json:"userAgentFilter,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down Expand Up @@ -95,6 +97,9 @@ func (ms *NgrokModuleSet) Merge(o *NgrokModuleSet) {
if omod.WebhookVerification != nil {
msmod.WebhookVerification = omod.WebhookVerification
}
if omod.UserAgentFilter != nil {
msmod.UserAgentFilter = omod.UserAgentFilter
}
}

//+kubebuilder:object:root=true
Expand Down
1 change: 1 addition & 0 deletions internal/store/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ func (d *Driver) calculateHTTPSEdges() map[string]ingressv1alpha1.HTTPSEdge {
OIDC: modSet.Modules.OIDC,
SAML: modSet.Modules.SAML,
WebhookVerification: modSet.Modules.WebhookVerification,
UserAgentFilter: modSet.Modules.UserAgentFilter,
}
route.Metadata = d.customMetadata

Expand Down

0 comments on commit 2be01b2

Please sign in to comment.