Skip to content

Commit 5c90496

Browse files
henrybarretogustavosbarreto
authored andcommitted
fix(ssh): use device uid's field from web endpoint to get connection
1 parent 339fa8d commit 5c90496

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

pkg/api/internalclient/device.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,15 @@ func (c *client) GetDevice(uid string) (*models.Device, error) {
124124
}
125125

126126
type WebEndpoint struct {
127-
Address string `json:"address"`
128-
Namespace string `json:"namespace"`
129-
Device string `json:"device"`
130-
Host string `json:"host"`
131-
Port int `json:"port"`
132-
TimeToLive int `json:"ttl"`
133-
ExpiresIn time.Time `json:"expires_in"`
134-
CreatedAt time.Time `json:"time" bson:"time"`
127+
Address string `json:"address"`
128+
Namespace string `json:"namespace"`
129+
DeviceUID string `json:"device_uid"`
130+
Device *models.Device `json:"device"`
131+
Host string `json:"host"`
132+
Port int `json:"port"`
133+
TimeToLive int `json:"ttl"`
134+
ExpiresIn time.Time `json:"expires_in"`
135+
CreatedAt time.Time `json:"time" bson:"time"`
135136
}
136137

137138
func (c *client) LookupWebEndpoints(address string) (*WebEndpoint, error) {

ssh/pkg/tunnel/tunnel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ func NewTunnel(connection string, dial string, config Config) (*Tunnel, error) {
217217
"device": endpoint.Device,
218218
})
219219

220-
in, err := tunnel.Dial(c.Request().Context(), fmt.Sprintf("%s:%s", endpoint.Namespace, endpoint.Device))
220+
in, err := tunnel.Dial(c.Request().Context(), fmt.Sprintf("%s:%s", endpoint.Namespace, endpoint.DeviceUID))
221221
if err != nil {
222222
logger.WithError(err).Error("failed to dial to device")
223223

0 commit comments

Comments
 (0)