extclient.go 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package models
  2. // ExtClient - struct for external clients
  3. type ExtClient struct {
  4. ClientID string `json:"clientid" bson:"clientid"`
  5. PrivateKey string `json:"privatekey" bson:"privatekey"`
  6. PublicKey string `json:"publickey" bson:"publickey"`
  7. Network string `json:"network" bson:"network"`
  8. DNS string `json:"dns" bson:"dns"`
  9. Address string `json:"address" bson:"address"`
  10. Address6 string `json:"address6" bson:"address6"`
  11. ExtraAllowedIPs []string `json:"extraallowedips" bson:"extraallowedips"`
  12. AllowedIPs []string `json:"allowed_ips"`
  13. IngressGatewayID string `json:"ingressgatewayid" bson:"ingressgatewayid"`
  14. IngressGatewayEndpoint string `json:"ingressgatewayendpoint" bson:"ingressgatewayendpoint"`
  15. LastModified int64 `json:"lastmodified" bson:"lastmodified" swaggertype:"primitive,integer" format:"int64"`
  16. Enabled bool `json:"enabled" bson:"enabled"`
  17. OwnerID string `json:"ownerid" bson:"ownerid"`
  18. DeniedACLs map[string]struct{} `json:"deniednodeacls" bson:"acls,omitempty"`
  19. RemoteAccessClientID string `json:"remote_access_client_id"` // unique ID (MAC address) of RAC machine
  20. PostUp string `json:"postup" bson:"postup"`
  21. PostDown string `json:"postdown" bson:"postdown"`
  22. Tags map[TagID]struct{} `json:"tags"`
  23. Os string `json:"os"`
  24. DeviceName string `json:"device_name"`
  25. PublicEndpoint string `json:"public_endpoint"`
  26. Country string `json:"country"`
  27. }
  28. // CustomExtClient - struct for CustomExtClient params
  29. type CustomExtClient struct {
  30. ClientID string `json:"clientid,omitempty"`
  31. PublicKey string `json:"publickey,omitempty"`
  32. DNS string `json:"dns,omitempty"`
  33. ExtraAllowedIPs []string `json:"extraallowedips,omitempty"`
  34. Enabled bool `json:"enabled,omitempty"`
  35. DeniedACLs map[string]struct{} `json:"deniednodeacls" bson:"acls,omitempty"`
  36. RemoteAccessClientID string `json:"remote_access_client_id"` // unique ID (MAC address) of RAC machine
  37. PostUp string `json:"postup" bson:"postup" validate:"max=1024"`
  38. PostDown string `json:"postdown" bson:"postdown" validate:"max=1024"`
  39. Tags map[TagID]struct{} `json:"tags"`
  40. Os string `json:"os"`
  41. DeviceName string `json:"device_name"`
  42. IsAlreadyConnectedToInetGw bool `json:"is_already_connected_to_inet_gw"`
  43. PublicEndpoint string `json:"public_endpoint"`
  44. Country string `json:"country"`
  45. }
  46. func (ext *ExtClient) ConvertToStaticNode() Node {
  47. return Node{
  48. CommonNode: CommonNode{
  49. Network: ext.Network,
  50. },
  51. Tags: ext.Tags,
  52. IsStatic: true,
  53. StaticNode: *ext,
  54. }
  55. }