Skip to content

Commit eb49205

Browse files
authored
Merge pull request #1356 from AkihiroSuda/dev
Drop dependency on github.com/yalue/native_endian and github.com/intel-go/cpuid
2 parents 21c7e31 + a1e8f74 commit eb49205

File tree

9 files changed

+11
-93
lines changed

9 files changed

+11
-93
lines changed

go.mod

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ require (
2121
github.com/google/go-cmp v0.5.9
2222
github.com/gorilla/mux v1.8.0
2323
github.com/hashicorp/go-multierror v1.1.1
24-
github.com/intel-go/cpuid v0.0.0-20220614022739-219e067757cb
2524
github.com/lima-vm/sshocker v0.3.1
2625
github.com/mattn/go-isatty v0.0.17
2726
github.com/mattn/go-shellwords v1.0.12
@@ -32,7 +31,6 @@ require (
3231
github.com/sirupsen/logrus v1.9.0
3332
github.com/spf13/cobra v1.6.1
3433
github.com/xorcare/pointer v1.2.2
35-
github.com/yalue/native_endian v1.0.2
3634
golang.org/x/sync v0.1.0
3735
golang.org/x/sys v0.5.0
3836
gotest.tools/v3 v3.4.0

go.sum

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,6 @@ github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7P
348348
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
349349
github.com/insomniacslk/dhcp v0.0.0-20220504074936-1ca156eafb9f h1:l1QCwn715k8nYkj4Ql50rzEog3WnMdrd4YYMMwemxEo=
350350
github.com/insomniacslk/dhcp v0.0.0-20220504074936-1ca156eafb9f/go.mod h1:h+MxyHxRg9NH3terB1nfRIUaQEcI0XOVkdR9LNBlp8E=
351-
github.com/intel-go/cpuid v0.0.0-20220614022739-219e067757cb h1:Fg0Y/RDZ6UPwl3o7/IzPbneDq8g9+gH6DPs42KFUsy8=
352-
github.com/intel-go/cpuid v0.0.0-20220614022739-219e067757cb/go.mod h1:RmeVYf9XrPRbRc3XIx0gLYA8qOFvNoPOfaEZduRlEp4=
353351
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
354352
github.com/jsimonetti/rtnetlink v0.0.0-20190606172950-9527aa82566a/go.mod h1:Oz+70psSo5OFh8DBl0Zv2ACw7Esh6pPUphlvZG9x7uw=
355353
github.com/jsimonetti/rtnetlink v0.0.0-20200117123717-f846d4f6c1f4/go.mod h1:WGuG/smIU4J/54PblvSbh+xvCZmpJnFgr3ds6Z55XMQ=
@@ -562,8 +560,6 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q
562560
github.com/xorcare/pointer v1.2.2 h1:zjD77b5DTehClND4MK+9dDE0DcpFIZisAJ/+yVJvKYA=
563561
github.com/xorcare/pointer v1.2.2/go.mod h1:azsKh7oVwYB7C1o8P284fG8MvtErX/F5/dqXiaj71ak=
564562
github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q=
565-
github.com/yalue/native_endian v1.0.2 h1:e4SxBbaCoOOO4E3axd7FSriUhzc1bIzqZGG5jl6Evbg=
566-
github.com/yalue/native_endian v1.0.2/go.mod h1:cr+I2WnCwDkkPV0DvgBpGQkJV12CDWR5bAoMtT+56iE=
567563
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
568564
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
569565
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=

pkg/guestagent/guestagent_linux.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package guestagent
22

33
import (
44
"context"
5-
"encoding/binary"
65
"errors"
76
"reflect"
87
"sync"
@@ -15,7 +14,7 @@ import (
1514
"github.com/lima-vm/lima/pkg/guestagent/procnettcp"
1615
"github.com/lima-vm/lima/pkg/guestagent/timesync"
1716
"github.com/sirupsen/logrus"
18-
"github.com/yalue/native_endian"
17+
"golang.org/x/sys/cpu"
1918
)
2019

2120
func New(newTicker func() (<-chan time.Time, func()), iptablesIdle time.Duration) (Agent, error) {
@@ -171,7 +170,7 @@ func (a *agent) Events(ctx context.Context, ch chan api.Event) {
171170
}
172171

173172
func (a *agent) LocalPorts(ctx context.Context) ([]api.IPPort, error) {
174-
if native_endian.NativeEndian() == binary.BigEndian {
173+
if cpu.IsBigEndian {
175174
return nil, errors.New("big endian architecture is unsupported, because I don't know how /proc/net/tcp looks like on big endian hosts")
176175
}
177176
var res []api.IPPort

pkg/sshutil/sshutil.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/lima-vm/lima/pkg/store/dirnames"
2121
"github.com/lima-vm/lima/pkg/store/filenames"
2222
"github.com/sirupsen/logrus"
23+
"golang.org/x/sys/cpu"
2324
)
2425

2526
type PubKey struct {
@@ -294,3 +295,11 @@ func detectValidPublicKey(content string) bool {
294295
var sigFormat = string(decodedKey[4 : 4+sigLength])
295296
return algo == sigFormat
296297
}
298+
299+
func detectAESAcceleration() bool {
300+
if !cpu.Initialized {
301+
logrus.Warn("Failed to detect CPU features. Assuming that AES acceleration is not available.")
302+
return false
303+
}
304+
return cpu.ARM.HasAES || cpu.ARM64.HasAES || cpu.S390X.HasAES || cpu.X86.HasAES
305+
}

pkg/sshutil/sshutil_darwin.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

pkg/sshutil/sshutil_linux.go

Lines changed: 0 additions & 20 deletions
This file was deleted.

pkg/sshutil/sshutil_others.go

Lines changed: 0 additions & 16 deletions
This file was deleted.

pkg/sshutil/sshutil_windows_amd64.go

Lines changed: 0 additions & 9 deletions
This file was deleted.

pkg/sshutil/sshutil_windows_arm64.go

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)