mirror of
https://github.com/gravitl/netmaker.git
synced 2025-10-11 03:32:03 +08:00

* Build(deps): bump gorm.io/datatypes from 1.2.5 to 1.2.6 Bumps [gorm.io/datatypes](https://github.com/go-gorm/datatypes) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/go-gorm/datatypes/releases) - [Commits](https://github.com/go-gorm/datatypes/compare/v1.2.5...v1.2.6) --- updated-dependencies: - dependency-name: gorm.io/datatypes dependency-version: 1.2.6 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Build(deps): bump google.golang.org/api from 0.238.0 to 0.240.0 (#3541) Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.238.0 to 0.240.0. - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md) - [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.238.0...v0.240.0) --- updated-dependencies: - dependency-name: google.golang.org/api dependency-version: 0.240.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Build(deps): bump github.com/go-playground/validator/v10 (#3539) Bumps [github.com/go-playground/validator/v10](https://github.com/go-playground/validator) from 10.26.0 to 10.27.0. - [Release notes](https://github.com/go-playground/validator/releases) - [Commits](https://github.com/go-playground/validator/compare/v10.26.0...v10.27.0) --- updated-dependencies: - dependency-name: github.com/go-playground/validator/v10 dependency-version: 10.27.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix(go): prevent idp user from being deleted; (#3538) * fix(go): use correct method for pro; fixes: User Config nodes are always reported online. * fix(go): add device id to extclient; * fix(go): try match device id; * fix(go): set device id if not set; * feat(go): return best match offline extclient; * fix(go): match device id with owner and gateway; * fix(go): remove check for rac id; * fix(go): check status on get node status; * fix(go): allow offline or unknown extclient; * feat(go): add count db method; * feat(go): revert change; --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Abhishek K <abhi281342@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
73 lines
3.9 KiB
Go
73 lines
3.9 KiB
Go
package models
|
|
|
|
import "sync"
|
|
|
|
// ExtClient - struct for external clients
|
|
type ExtClient struct {
|
|
ClientID string `json:"clientid" bson:"clientid"`
|
|
PrivateKey string `json:"privatekey" bson:"privatekey"`
|
|
PublicKey string `json:"publickey" bson:"publickey"`
|
|
Network string `json:"network" bson:"network"`
|
|
DNS string `json:"dns" bson:"dns"`
|
|
Address string `json:"address" bson:"address"`
|
|
Address6 string `json:"address6" bson:"address6"`
|
|
ExtraAllowedIPs []string `json:"extraallowedips" bson:"extraallowedips"`
|
|
AllowedIPs []string `json:"allowed_ips"`
|
|
IngressGatewayID string `json:"ingressgatewayid" bson:"ingressgatewayid"`
|
|
IngressGatewayEndpoint string `json:"ingressgatewayendpoint" bson:"ingressgatewayendpoint"`
|
|
LastModified int64 `json:"lastmodified" bson:"lastmodified" swaggertype:"primitive,integer" format:"int64"`
|
|
Enabled bool `json:"enabled" bson:"enabled"`
|
|
OwnerID string `json:"ownerid" bson:"ownerid"`
|
|
DeniedACLs map[string]struct{} `json:"deniednodeacls" bson:"acls,omitempty"`
|
|
RemoteAccessClientID string `json:"remote_access_client_id"` // unique ID (MAC address) of RAC machine
|
|
PostUp string `json:"postup" bson:"postup"`
|
|
PostDown string `json:"postdown" bson:"postdown"`
|
|
Tags map[TagID]struct{} `json:"tags"`
|
|
Os string `json:"os"`
|
|
DeviceID string `json:"device_id"`
|
|
DeviceName string `json:"device_name"`
|
|
PublicEndpoint string `json:"public_endpoint"`
|
|
Country string `json:"country"`
|
|
Location string `json:"location"` //format: lat,long
|
|
Mutex *sync.Mutex `json:"-"`
|
|
}
|
|
|
|
// CustomExtClient - struct for CustomExtClient params
|
|
type CustomExtClient struct {
|
|
ClientID string `json:"clientid,omitempty"`
|
|
PublicKey string `json:"publickey,omitempty"`
|
|
DNS string `json:"dns,omitempty"`
|
|
ExtraAllowedIPs []string `json:"extraallowedips,omitempty"`
|
|
Enabled bool `json:"enabled,omitempty"`
|
|
DeniedACLs map[string]struct{} `json:"deniednodeacls" bson:"acls,omitempty"`
|
|
RemoteAccessClientID string `json:"remote_access_client_id"` // unique ID (MAC address) of RAC machine
|
|
PostUp string `json:"postup" bson:"postup" validate:"max=1024"`
|
|
PostDown string `json:"postdown" bson:"postdown" validate:"max=1024"`
|
|
Tags map[TagID]struct{} `json:"tags"`
|
|
Os string `json:"os"`
|
|
DeviceID string `json:"device_id"`
|
|
DeviceName string `json:"device_name"`
|
|
IsAlreadyConnectedToInetGw bool `json:"is_already_connected_to_inet_gw"`
|
|
PublicEndpoint string `json:"public_endpoint"`
|
|
Country string `json:"country"`
|
|
Location string `json:"location"` //format: lat,long
|
|
}
|
|
|
|
func (ext *ExtClient) ConvertToStaticNode() Node {
|
|
if ext.Tags == nil {
|
|
ext.Tags = make(map[TagID]struct{})
|
|
}
|
|
return Node{
|
|
CommonNode: CommonNode{
|
|
Network: ext.Network,
|
|
Address: ext.AddressIPNet4(),
|
|
Address6: ext.AddressIPNet6(),
|
|
},
|
|
Tags: ext.Tags,
|
|
IsStatic: true,
|
|
StaticNode: *ext,
|
|
IsUserNode: ext.RemoteAccessClientID != "",
|
|
Mutex: ext.Mutex,
|
|
}
|
|
}
|