@@ -20,7 +20,7 @@ import (
2020 "github.com/lima-vm/lima/v2/pkg/guestagent/api"
2121 "github.com/lima-vm/lima/v2/pkg/guestagent/iptables"
2222 "github.com/lima-vm/lima/v2/pkg/guestagent/kubernetesservice"
23- "github.com/lima-vm/lima/v2/pkg/guestagent/procnettcp "
23+ "github.com/lima-vm/lima/v2/pkg/guestagent/sockets "
2424 "github.com/lima-vm/lima/v2/pkg/guestagent/ticker"
2525 "github.com/lima-vm/lima/v2/pkg/guestagent/timesync"
2626)
@@ -222,24 +222,24 @@ func (a *agent) Events(ctx context.Context, ch chan *api.Event) {
222222
223223func (a * agent ) LocalPorts (ctx context.Context ) ([]* api.IPPort , error ) {
224224 var res []* api.IPPort
225- tcpParsed , err := procnettcp . ParseFiles ()
225+ socketsList , err := sockets . List ()
226226 if err != nil {
227227 return res , err
228228 }
229229
230- for _ , f := range tcpParsed {
230+ for _ , f := range socketsList {
231231 switch f .Kind {
232- case procnettcp .TCP , procnettcp .TCP6 :
233- if f .State == procnettcp .TCPListen {
232+ case sockets .TCP , sockets .TCP6 :
233+ if f .State == sockets .TCPListen {
234234 res = append (res ,
235235 & api.IPPort {
236236 Ip : f .IP .String (),
237237 Port : int32 (f .Port ),
238238 Protocol : "tcp" ,
239239 })
240240 }
241- case procnettcp .UDP , procnettcp .UDP6 :
242- if f .State == procnettcp .UDPUnconnected {
241+ case sockets .UDP , sockets .UDP6 :
242+ if f .State == sockets .UDPUnconnected {
243243 res = append (res ,
244244 & api.IPPort {
245245 Ip : f .IP .String (),
@@ -274,7 +274,7 @@ func (a *agent) LocalPorts(ctx context.Context) ([]*api.IPPort, error) {
274274
275275 for _ , ipt := range ipts {
276276 port := int32 (ipt .AddrPort .Port ())
277- // Make sure the port isn't already listed from procnettcp
277+ // Make sure the port isn't already listed from sockets
278278 found := false
279279 for _ , re := range res {
280280 if re .Port == port {
0 commit comments