Skip to content

Commit d92ac65

Browse files
committed
Add support for OnDemand
1 parent e399fb4 commit d92ac65

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

core/vpn.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ func CreateVPN(vpn *model.VPN) (*model.VPN, error) {
7979
vpn.Current.HasSSH = current.HasSSH
8080
}
8181

82+
vpn.Current.IncludedApps = current.IncludedApps
83+
vpn.Current.ExcludedApps = current.ExcludedApps
84+
vpn.Current.OnDemand = current.OnDemand
85+
vpn.Current.EnableApps = current.EnableApps
86+
vpn.Current.EnableOnDemand = current.EnableOnDemand
87+
8288
// if the vpn data already has a public key and empty private key,
8389
// we know the client has already generated a key pair
8490
if vpn.Current.PublicKey != "" && vpn.Current.PrivateKey == "" {
@@ -144,6 +150,7 @@ func CreateVPN(vpn *model.VPN) (*model.VPN, error) {
144150
vpn.Current.PostDown = Sanitize(vpn.Current.PostDown)
145151
vpn.Current.IncludedApps = Sanitize(vpn.Current.IncludedApps)
146152
vpn.Current.ExcludedApps = Sanitize(vpn.Current.ExcludedApps)
153+
vpn.Current.OnDemand = Sanitize(vpn.Current.OnDemand)
147154

148155
// check if vpn is valid
149156
errs := vpn.IsValid()
@@ -328,6 +335,7 @@ func UpdateVPN(Id string, vpn *model.VPN, flag bool) (*model.VPN, error) {
328335
vpn.Current.PostDown = Sanitize(vpn.Current.PostDown)
329336
vpn.Current.IncludedApps = Sanitize(vpn.Current.IncludedApps)
330337
vpn.Current.ExcludedApps = Sanitize(vpn.Current.ExcludedApps)
338+
vpn.Current.OnDemand = Sanitize(vpn.Current.OnDemand)
331339

332340
// check if vpn is valid
333341
errs := vpn.IsValid()

model/settings.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ type Settings struct {
2828
HasRDP bool `json:"hasRDP,omitempty" bson:"hasRDP,omitempty"`
2929
ShowSystemApps *bool `json:"showSystemApps,omitempty" bson:"showSystemApps,omitempty"`
3030
EnableApps *bool `json:"enableApps,omitempty" bson:"enableApps,omitempty"`
31+
EnableOnDemand *bool `json:"enableOnDemand,omitempty" bson:"enableOnDemand,omitempty"`
3132
PreUp string `json:"preUp,omitempty" bson:"preUp,omitempty"`
3233
PostUp string `json:"postUp,omitempty" bson:"postUp,omitempty"`
3334
PreDown string `json:"preDown,omitempty" bson:"preDown,omitempty"`
3435
PostDown string `json:"postDown,omitempty" bson:"postDown,omitempty"`
3536
IncludedApps string `json:"includedApps,omitempty" bson:"includedApps,omitempty"`
3637
ExcludedApps string `json:"excludedApps,omitempty" bson:"excludedApps,omitempty"`
38+
OnDemand string `json:"onDemand,omitempty" bson:"onDemand,omitempty"`
3739
}
3840

3941
// IsValid check if model is valid

0 commit comments

Comments
 (0)