mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-13 08:34:44 +08:00
feat: receive device info and public endpoint from rac (#3215)
This commit is contained in:
parent
1bfcebaf91
commit
89751480e8
2 changed files with 26 additions and 10 deletions
|
@ -490,6 +490,13 @@ func createExtClient(w http.ResponseWriter, r *http.Request) {
|
||||||
if err == nil { // check if parent network default ACL is enabled (yes) or not (no)
|
if err == nil { // check if parent network default ACL is enabled (yes) or not (no)
|
||||||
extclient.Enabled = parentNetwork.DefaultACL == "yes"
|
extclient.Enabled = parentNetwork.DefaultACL == "yes"
|
||||||
}
|
}
|
||||||
|
extclient.Os = customExtClient.Os
|
||||||
|
extclient.DeviceName = customExtClient.DeviceName
|
||||||
|
if customExtClient.IsAlreadyConnectedToInetGw {
|
||||||
|
slog.Warn("RAC/Client is already connected to internet gateway. this may mask their real IP address", "client IP", customExtClient.PublicEndpoint)
|
||||||
|
}
|
||||||
|
extclient.PublicEndpoint = customExtClient.PublicEndpoint
|
||||||
|
extclient.Country = customExtClient.Country
|
||||||
|
|
||||||
if err = logic.CreateExtClient(&extclient); err != nil {
|
if err = logic.CreateExtClient(&extclient); err != nil {
|
||||||
slog.Error(
|
slog.Error(
|
||||||
|
|
|
@ -21,20 +21,29 @@ type ExtClient struct {
|
||||||
PostUp string `json:"postup" bson:"postup"`
|
PostUp string `json:"postup" bson:"postup"`
|
||||||
PostDown string `json:"postdown" bson:"postdown"`
|
PostDown string `json:"postdown" bson:"postdown"`
|
||||||
Tags map[TagID]struct{} `json:"tags"`
|
Tags map[TagID]struct{} `json:"tags"`
|
||||||
|
Os string `json:"os"`
|
||||||
|
DeviceName string `json:"device_name"`
|
||||||
|
PublicEndpoint string `json:"public_endpoint"`
|
||||||
|
Country string `json:"country"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CustomExtClient - struct for CustomExtClient params
|
// CustomExtClient - struct for CustomExtClient params
|
||||||
type CustomExtClient struct {
|
type CustomExtClient struct {
|
||||||
ClientID string `json:"clientid,omitempty"`
|
ClientID string `json:"clientid,omitempty"`
|
||||||
PublicKey string `json:"publickey,omitempty"`
|
PublicKey string `json:"publickey,omitempty"`
|
||||||
DNS string `json:"dns,omitempty"`
|
DNS string `json:"dns,omitempty"`
|
||||||
ExtraAllowedIPs []string `json:"extraallowedips,omitempty"`
|
ExtraAllowedIPs []string `json:"extraallowedips,omitempty"`
|
||||||
Enabled bool `json:"enabled,omitempty"`
|
Enabled bool `json:"enabled,omitempty"`
|
||||||
DeniedACLs map[string]struct{} `json:"deniednodeacls" bson:"acls,omitempty"`
|
DeniedACLs map[string]struct{} `json:"deniednodeacls" bson:"acls,omitempty"`
|
||||||
RemoteAccessClientID string `json:"remote_access_client_id"` // unique ID (MAC address) of RAC machine
|
RemoteAccessClientID string `json:"remote_access_client_id"` // unique ID (MAC address) of RAC machine
|
||||||
PostUp string `json:"postup" bson:"postup" validate:"max=1024"`
|
PostUp string `json:"postup" bson:"postup" validate:"max=1024"`
|
||||||
PostDown string `json:"postdown" bson:"postdown" validate:"max=1024"`
|
PostDown string `json:"postdown" bson:"postdown" validate:"max=1024"`
|
||||||
Tags map[TagID]struct{} `json:"tags"`
|
Tags map[TagID]struct{} `json:"tags"`
|
||||||
|
Os string `json:"os"`
|
||||||
|
DeviceName string `json:"device_name"`
|
||||||
|
IsAlreadyConnectedToInetGw bool `json:"is_already_connected_to_inet_gw"`
|
||||||
|
PublicEndpoint string `json:"public_endpoint"`
|
||||||
|
Country string `json:"country"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ext *ExtClient) ConvertToStaticNode() Node {
|
func (ext *ExtClient) ConvertToStaticNode() Node {
|
||||||
|
|
Loading…
Add table
Reference in a new issue