From 1543e2b0e5b9996bef34c7abda4db397f97e475e Mon Sep 17 00:00:00 2001 From: bkleiner Date: Wed, 7 Oct 2020 18:51:51 +0200 Subject: [PATCH] filter ports on mac --- cmd/quic-config/server.go | 13 +++++++++++++ go.mod | 2 +- go.sum | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cmd/quic-config/server.go b/cmd/quic-config/server.go index e917a864..d9b39f8b 100644 --- a/cmd/quic-config/server.go +++ b/cmd/quic-config/server.go @@ -3,6 +3,8 @@ package main import ( "net/http" "reflect" + "runtime" + "strings" "sync" "time" @@ -121,6 +123,17 @@ func (s *Server) controllerStatus() (*Status, error) { HasDFU: s.dfuLoader != nil, HasUpdate: s.updater.found, } + if runtime.GOOS == "darwin" { + status.AvailablePorts = make([]string, 0) + for _, p := range ports { + if !strings.HasPrefix("/dev/cu", p) { + status.AvailablePorts = append(status.AvailablePorts, p) + } + } + } else { + status.AvailablePorts = ports + } + if s.fc != nil { status.Port = s.fc.PortName status.Info = s.qp.Info diff --git a/go.mod b/go.mod index f987b506..0ce01aa6 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 // indirect golang.org/x/net v0.0.0-20201006153459-a7d1128ccaa0 // indirect golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 - golang.org/x/sys v0.0.0-20201006155630-ac719f4daadf // indirect + golang.org/x/sys v0.0.0-20201007082116-8445cc04cbdf // indirect gopkg.in/djherbis/atime.v1 v1.0.0 // indirect gopkg.in/djherbis/fscache.v0 v0.10.1 gopkg.in/djherbis/stream.v1 v1.3.1 // indirect diff --git a/go.sum b/go.sum index 115fa0ee..4c5a1a47 100644 --- a/go.sum +++ b/go.sum @@ -271,6 +271,8 @@ golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201006155630-ac719f4daadf h1:Bg47KQy0JhTHuf4sLiQwTMKwUMfSDwgSGatrxGR7nLM= golang.org/x/sys v0.0.0-20201006155630-ac719f4daadf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201007082116-8445cc04cbdf h1:AvBTl0xbF/KtHyvm61X4gSPF7/dKJ/xQqJwKr1Qu9no= +golang.org/x/sys v0.0.0-20201007082116-8445cc04cbdf/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=