// HandleChannel handles one SSH channel func (c *Client) HandleChannel(newChannel ssh.NewChannel) error { if newChannel.ChannelType() != "session" { log.Debugf("Unknown channel type: %s", newChannel.ChannelType()) newChannel.Reject(ssh.UnknownChannelType, "unknown channel type") return nil } channel, requests, err := newChannel.Accept() if err != nil { log.Errorf("newChannel.Accept failed: %v", err) return err } c.ChannelIdx++ log.Debugf("HandleChannel.channel (client=%d channel=%d)", c.Idx, c.ChannelIdx) log.Debug("Creating pty...") c.Pty, c.Tty, err = pty.Open() if err != nil { log.Errorf("pty.Open failed: %v", err) return nil } c.HandleChannelRequests(channel, requests) return nil }
func (m *Markup) processTree(mwQuery *mwQuery) { log.Debug("Processing Tree") setNext := func(curr *Wave) { for _, n := range m.Impulses { if curr.Ends() == n.Begins() && curr.Degree() == n.Degree() { curr.Next = n.Wave n.Prev = curr return } } for _, n := range m.Corrections { if curr.Ends() == n.Begins() && curr.Degree() == n.Degree() { curr.Next = n.Wave n.Prev = curr return } } } for _, i := range m.Impulses { if i.Next == nil { setNext(i.Wave) } } for _, i := range m.Corrections { if i.Next == nil { setNext(i.Wave) } } }
func (mw *mwQuery) importMotiveWaveXML(path string) error { log.Debug("Importing " + path) data, err := ioutil.ReadFile(path) if err != nil { return err } return xml.Unmarshal(data, mw) }
func main() { log.SetHandler(cli.New(os.Stdout)) log.SetLevel(log.DebugLevel) s, err := config.LoadConfig(ConfigurationFileName) if err != nil { log.Warnf("Unable to read configuration file: %s", err.Error()) } d, err := store.Init(s.Location.Database, 2500) if err != nil { log.Fatalf("Unable to connect to data store at %s: %s", s.Location.Database, err.Error()) } r := gin.New() // If redirects to the secure are enabled, attach the secure middleware helper if s.Bind.Redirect { log.Debug("Secure redirects enabled") r.Use(secure.RedirectToSecureByProxy(s.Domain, s.Bind.Ports.Secure, s.Bind.Proxy.Secure)) } r.Use(gin.Logger()) r.Use(gin.Recovery()) // Add out own Middleware r.Use(store.Connect(d)) // Connect the relevant modules to the router alive.Init(r) log.Debug("Starting Run()") err = r.Run(s.Bind.Address + ":" + strconv.FormatInt(int64(s.Bind.Ports.Standard), 10)) if err != nil { log.Fatalf("Fatal error during Run: %s", err.Error()) } }
// Debug level message. func Debug(msg string) { apexlog.Debug(msg) }
Long: `Connects to The Things Network and prints out messages received from the specified devices.`, Run: func(cmd *cobra.Command, args []string) { if len(args) == 0 && !followAll { cmd.Help() return } // Set up MQTT Client setupMQTT() // Subscribe to device topics switch { case followAll: devices = []string{"+"} log.Debug("Will subscribe to all devices") case len(args) == 1: devices = args log.Debugf("Will subscribe to device %s", devices[0]) default: devices = args log.Debugf("Will subscribe to %d devices", len(devices)) } // Connect connectMQTT() // Keep running... for { time.Sleep(60 * time.Second) }