Skip to content

Commit

Permalink
add ingresspersistentkeepalive and ingressmtu for extClient/RAC config
Browse files Browse the repository at this point in the history
  • Loading branch information
yabinma committed Sep 5, 2024
1 parent 9a748a5 commit 1ff5cd6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
6 changes: 6 additions & 0 deletions controllers/ext_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ func getExtClientConf(w http.ResponseWriter, r *http.Request) {
if network.DefaultKeepalive != 0 {
keepalive = "PersistentKeepalive = " + strconv.Itoa(int(network.DefaultKeepalive))
}
if gwnode.IngressPersistentKeepalive != 0 {
keepalive = "PersistentKeepalive = " + strconv.Itoa(int(gwnode.IngressPersistentKeepalive))
}

gwendpoint := ""
if preferredIp == "" {
Expand Down Expand Up @@ -289,6 +292,9 @@ func getExtClientConf(w http.ResponseWriter, r *http.Request) {
if host.MTU != 0 {
defaultMTU = host.MTU
}
if gwnode.IngressMTU != 0 {
defaultMTU = int(gwnode.IngressMTU)
}

postUp := strings.Builder{}
if client.PostUp != "" && params["type"] != "qr" {
Expand Down
2 changes: 2 additions & 0 deletions logic/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ func CreateIngressGateway(netid string, nodeid string, ingress models.IngressReq
node.IngressGatewayRange = network.AddressRange
node.IngressGatewayRange6 = network.AddressRange6
node.IngressDNS = ingress.ExtclientDNS
node.IngressPersistentKeepalive = ingress.PersistentKeepalive
node.IngressMTU = ingress.MTU
if servercfg.IsPro {
if _, exists := FailOverExists(node.Network); exists {
ResetFailedOverPeer(&node)
Expand Down
22 changes: 12 additions & 10 deletions models/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,18 @@ type CommonNode struct {
// Node - a model of a network node
type Node struct {
CommonNode
PendingDelete bool `json:"pendingdelete" bson:"pendingdelete" yaml:"pendingdelete"`
LastModified time.Time `json:"lastmodified" bson:"lastmodified" yaml:"lastmodified"`
LastCheckIn time.Time `json:"lastcheckin" bson:"lastcheckin" yaml:"lastcheckin"`
LastPeerUpdate time.Time `json:"lastpeerupdate" bson:"lastpeerupdate" yaml:"lastpeerupdate"`
ExpirationDateTime time.Time `json:"expdatetime" bson:"expdatetime" yaml:"expdatetime"`
EgressGatewayNatEnabled bool `json:"egressgatewaynatenabled" bson:"egressgatewaynatenabled" yaml:"egressgatewaynatenabled"`
EgressGatewayRequest EgressGatewayRequest `json:"egressgatewayrequest" bson:"egressgatewayrequest" yaml:"egressgatewayrequest"`
IngressGatewayRange string `json:"ingressgatewayrange" bson:"ingressgatewayrange" yaml:"ingressgatewayrange"`
IngressGatewayRange6 string `json:"ingressgatewayrange6" bson:"ingressgatewayrange6" yaml:"ingressgatewayrange6"`
Metadata string `json:"metadata"`
PendingDelete bool `json:"pendingdelete" bson:"pendingdelete" yaml:"pendingdelete"`
LastModified time.Time `json:"lastmodified" bson:"lastmodified" yaml:"lastmodified"`
LastCheckIn time.Time `json:"lastcheckin" bson:"lastcheckin" yaml:"lastcheckin"`
LastPeerUpdate time.Time `json:"lastpeerupdate" bson:"lastpeerupdate" yaml:"lastpeerupdate"`
ExpirationDateTime time.Time `json:"expdatetime" bson:"expdatetime" yaml:"expdatetime"`
EgressGatewayNatEnabled bool `json:"egressgatewaynatenabled" bson:"egressgatewaynatenabled" yaml:"egressgatewaynatenabled"`
EgressGatewayRequest EgressGatewayRequest `json:"egressgatewayrequest" bson:"egressgatewayrequest" yaml:"egressgatewayrequest"`
IngressGatewayRange string `json:"ingressgatewayrange" bson:"ingressgatewayrange" yaml:"ingressgatewayrange"`
IngressGatewayRange6 string `json:"ingressgatewayrange6" bson:"ingressgatewayrange6" yaml:"ingressgatewayrange6"`
IngressPersistentKeepalive int32 `json:"ingresspersistentkeepalive" bson:"ingresspersistentkeepalive" yaml:"ingresspersistentkeepalive"`
IngressMTU int32 `json:"ingressmtu" bson:"ingressmtu" yaml:"ingressmtu"`
Metadata string `json:"metadata"`
// == PRO ==
DefaultACL string `json:"defaultacl,omitempty" bson:"defaultacl,omitempty" yaml:"defaultacl,omitempty" validate:"checkyesornoorunset"`
OwnerID string `json:"ownerid,omitempty" bson:"ownerid,omitempty" yaml:"ownerid,omitempty"`
Expand Down
8 changes: 5 additions & 3 deletions models/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,11 @@ type HostRelayRequest struct {

// IngressRequest - ingress request struct
type IngressRequest struct {
ExtclientDNS string `json:"extclientdns"`
IsInternetGateway bool `json:"is_internet_gw"`
Metadata string `json:"metadata"`
ExtclientDNS string `json:"extclientdns"`
IsInternetGateway bool `json:"is_internet_gw"`
Metadata string `json:"metadata"`
PersistentKeepalive int32 `json:"persistentkeepalive"`
MTU int32 `json:"mtu"`
}

// InetNodeReq - exit node request struct
Expand Down

0 comments on commit 1ff5cd6

Please sign in to comment.