88 "strconv"
99 "time"
1010
11- "github.com/jinzhu/gorm/dialects/postgres "
11+ "gorm.io/datatypes "
1212 "inet.af/netaddr"
1313 "tailscale.com/tailcfg"
1414 "tailscale.com/wgengine/wgcfg"
@@ -33,9 +33,9 @@ type Machine struct {
3333 LastSeen * time.Time
3434 Expiry * time.Time
3535
36- HostInfo postgres. Jsonb
37- Endpoints postgres. Jsonb
38- EnabledRoutes postgres. Jsonb
36+ HostInfo datatypes. JSON
37+ Endpoints datatypes. JSON
38+ EnabledRoutes datatypes. JSON
3939
4040 CreatedAt time.Time
4141 UpdatedAt time.Time
@@ -79,7 +79,7 @@ func (m Machine) toNode() (*tailcfg.Node, error) {
7979 allowedIPs = append (allowedIPs , ip ) // we append the node own IP, as it is required by the clients
8080
8181 routesStr := []string {}
82- if len (m .EnabledRoutes . RawMessage ) != 0 {
82+ if len (m .EnabledRoutes ) != 0 {
8383 allwIps , err := m .EnabledRoutes .MarshalJSON ()
8484 if err != nil {
8585 return nil , err
@@ -99,7 +99,7 @@ func (m Machine) toNode() (*tailcfg.Node, error) {
9999 }
100100
101101 endpoints := []string {}
102- if len (m .Endpoints . RawMessage ) != 0 {
102+ if len (m .Endpoints ) != 0 {
103103 be , err := m .Endpoints .MarshalJSON ()
104104 if err != nil {
105105 return nil , err
@@ -111,7 +111,7 @@ func (m Machine) toNode() (*tailcfg.Node, error) {
111111 }
112112
113113 hostinfo := tailcfg.Hostinfo {}
114- if len (m .HostInfo . RawMessage ) != 0 {
114+ if len (m .HostInfo ) != 0 {
115115 hi , err := m .HostInfo .MarshalJSON ()
116116 if err != nil {
117117 return nil , err
@@ -198,7 +198,7 @@ func (h *Headscale) GetMachine(namespace string, name string) (*Machine, error)
198198// GetHostInfo returns a Hostinfo struct for the machine
199199func (m * Machine ) GetHostInfo () (* tailcfg.Hostinfo , error ) {
200200 hostinfo := tailcfg.Hostinfo {}
201- if len (m .HostInfo . RawMessage ) != 0 {
201+ if len (m .HostInfo ) != 0 {
202202 hi , err := m .HostInfo .MarshalJSON ()
203203 if err != nil {
204204 return nil , err
0 commit comments