Loading tdmbs/tdmbs.go +16 −0 Original line number Diff line number Diff line package tdmbs import "errors" const ( DefaultPortCommands = 31285 DefaultPortEvents = 31286 DefaultBroadcastDiscoveryText = "{362E4489-482E-4E45-B782-43F80FF58809}" ) type Server struct { } func New() *Server { return &Server{} } func (s *Server) FindLocalNetworkAdresses() error { return errors.New("not implemented") } func (s *Server) FindWithBroadcast() error { return errors.New("not implemented") } tdmbs/tdmbs_test.go +39 −3 Original line number Diff line number Diff line package tdmbs import "testing" import ( "net" "testing" ) func TestSkip(t *testing.T) { t.Skip("not implemented") func TestFindLocalNetworks(t *testing.T) { ifaces, err := net.Interfaces() if err != nil { t.Fatalf("net.Interfaces() failed with: %s", err) } for _, ifc := range ifaces { if (ifc.Flags & net.FlagLoopback) == net.FlagLoopback { continue } if (ifc.Flags & net.FlagUp) != net.FlagUp { continue } if (ifc.Flags & net.FlagPointToPoint) == net.FlagPointToPoint { continue } if (ifc.Flags & net.FlagBroadcast) != net.FlagBroadcast { continue } addrs, err := ifc.Addrs() if err != nil { t.Errorf("ifc.Addrs() failed with: %s", err) continue } if len(addrs) < 1 { continue } t.Logf("- %#v", ifc) for _, addr := range addrs { t.Logf(" - %s", addr) } } } Loading
tdmbs/tdmbs.go +16 −0 Original line number Diff line number Diff line package tdmbs import "errors" const ( DefaultPortCommands = 31285 DefaultPortEvents = 31286 DefaultBroadcastDiscoveryText = "{362E4489-482E-4E45-B782-43F80FF58809}" ) type Server struct { } func New() *Server { return &Server{} } func (s *Server) FindLocalNetworkAdresses() error { return errors.New("not implemented") } func (s *Server) FindWithBroadcast() error { return errors.New("not implemented") }
tdmbs/tdmbs_test.go +39 −3 Original line number Diff line number Diff line package tdmbs import "testing" import ( "net" "testing" ) func TestSkip(t *testing.T) { t.Skip("not implemented") func TestFindLocalNetworks(t *testing.T) { ifaces, err := net.Interfaces() if err != nil { t.Fatalf("net.Interfaces() failed with: %s", err) } for _, ifc := range ifaces { if (ifc.Flags & net.FlagLoopback) == net.FlagLoopback { continue } if (ifc.Flags & net.FlagUp) != net.FlagUp { continue } if (ifc.Flags & net.FlagPointToPoint) == net.FlagPointToPoint { continue } if (ifc.Flags & net.FlagBroadcast) != net.FlagBroadcast { continue } addrs, err := ifc.Addrs() if err != nil { t.Errorf("ifc.Addrs() failed with: %s", err) continue } if len(addrs) < 1 { continue } t.Logf("- %#v", ifc) for _, addr := range addrs { t.Logf(" - %s", addr) } } }