wgengine/magicsock: extract IMDS utilities into a standalone package (#18334)
Moves magicksock.cloudInfo into util/cloudinfo with minimal changes. Updates #17796 Change-Id: I83f32473b9180074d5cdbf00fa31e5b3f579f189 Signed-off-by: Alex Valiushko <alexvaliushko@tailscale.com>main
parent
a662c541ab
commit
4c3cf8bb11
@ -0,0 +1,26 @@ |
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build ios || android || js
|
||||
|
||||
package cloudinfo |
||||
|
||||
import ( |
||||
"context" |
||||
"net/netip" |
||||
|
||||
"tailscale.com/types/logger" |
||||
) |
||||
|
||||
// CloudInfo is not available in mobile and JS targets.
|
||||
type CloudInfo struct{} |
||||
|
||||
// New construct a no-op CloudInfo stub.
|
||||
func New(_ logger.Logf) *CloudInfo { |
||||
return &CloudInfo{} |
||||
} |
||||
|
||||
// GetPublicIPs always returns nil slice and error.
|
||||
func (ci *CloudInfo) GetPublicIPs(_ context.Context) ([]netip.Addr, error) { |
||||
return nil, nil |
||||
} |
||||
@ -1,23 +0,0 @@ |
||||
// Copyright (c) Tailscale Inc & AUTHORS
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
//go:build ios || android || js
|
||||
|
||||
package magicsock |
||||
|
||||
import ( |
||||
"context" |
||||
"net/netip" |
||||
|
||||
"tailscale.com/types/logger" |
||||
) |
||||
|
||||
type cloudInfo struct{} |
||||
|
||||
func newCloudInfo(_ logger.Logf) *cloudInfo { |
||||
return &cloudInfo{} |
||||
} |
||||
|
||||
func (ci *cloudInfo) GetPublicIPs(_ context.Context) ([]netip.Addr, error) { |
||||
return nil, nil |
||||
} |
||||
Loading…
Reference in new issue