27 Commits

Author SHA1 Message Date
Joel Wetzell
eb25c73f3a Merge pull request #146 from jwetzell/api-decouple
work towards decoupling api from router
2026-05-06 17:18:31 -05:00
Joel Wetzell
984cb435d5 work towards decoupling api from router 2026-05-06 17:16:45 -05:00
Joel Wetzell
427d69d443 Merge pull request #144 from jwetzell/dependabot/go_modules/github.com/nats-io/nats-server/v2-2.14.0
Bump github.com/nats-io/nats-server/v2 from 2.12.8 to 2.14.0
2026-05-05 17:16:09 -05:00
Joel Wetzell
ecb5b1ce12 Merge pull request #145 from jwetzell/dependabot/go_modules/modernc.org/quickjs-0.18.1
Bump modernc.org/quickjs from 0.18.0 to 0.18.1
2026-05-05 17:15:54 -05:00
dependabot[bot]
b81a1344b3 Bump modernc.org/quickjs from 0.18.0 to 0.18.1
Bumps [modernc.org/quickjs](https://gitlab.com/cznic/quickjs) from 0.18.0 to 0.18.1.
- [Commits](https://gitlab.com/cznic/quickjs/compare/v0.18.0...v0.18.1)

---
updated-dependencies:
- dependency-name: modernc.org/quickjs
  dependency-version: 0.18.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-05 17:28:46 +00:00
dependabot[bot]
eca1db9605 Bump github.com/nats-io/nats-server/v2 from 2.12.8 to 2.14.0
Bumps [github.com/nats-io/nats-server/v2](https://github.com/nats-io/nats-server) from 2.12.8 to 2.14.0.
- [Release notes](https://github.com/nats-io/nats-server/releases)
- [Changelog](https://github.com/nats-io/nats-server/blob/main/RELEASES.md)
- [Commits](https://github.com/nats-io/nats-server/compare/v2.12.8...v2.14.0)

---
updated-dependencies:
- dependency-name: github.com/nats-io/nats-server/v2
  dependency-version: 2.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-05-05 17:28:38 +00:00
Joel Wetzell
c1b3b6d553 Merge pull request #141 from jwetzell/dependabot/go_modules/github.com/redis/go-redis/v9-9.19.0
Bump github.com/redis/go-redis/v9 from 9.18.0 to 9.19.0
2026-04-29 13:33:37 -05:00
Joel Wetzell
e7989bd950 Merge pull request #140 from jwetzell/dependabot/go_modules/github.com/nats-io/nats-server/v2-2.12.8
Bump github.com/nats-io/nats-server/v2 from 2.12.7 to 2.12.8
2026-04-29 13:32:55 -05:00
Joel Wetzell
bc23815062 Merge pull request #139 from jwetzell/dependabot/go_modules/modernc.org/sqlite-1.50.0
Bump modernc.org/sqlite from 1.49.1 to 1.50.0
2026-04-29 13:32:46 -05:00
Joel Wetzell
cb34fdfb50 Merge pull request #142 from jwetzell/dependabot/go_modules/github.com/emiago/sipgo-1.3.1
Bump github.com/emiago/sipgo from 1.3.0 to 1.3.1
2026-04-29 13:32:29 -05:00
Joel Wetzell
aa8adf704e Merge pull request #143 from jwetzell/dependabot/go_modules/github.com/google/jsonschema-go-0.4.3
Bump github.com/google/jsonschema-go from 0.4.2 to 0.4.3
2026-04-29 13:32:18 -05:00
dependabot[bot]
dab8f20566 Bump github.com/google/jsonschema-go from 0.4.2 to 0.4.3
Bumps [github.com/google/jsonschema-go](https://github.com/google/jsonschema-go) from 0.4.2 to 0.4.3.
- [Release notes](https://github.com/google/jsonschema-go/releases)
- [Commits](https://github.com/google/jsonschema-go/compare/v0.4.2...0.4.3)

---
updated-dependencies:
- dependency-name: github.com/google/jsonschema-go
  dependency-version: 0.4.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-28 17:27:28 +00:00
dependabot[bot]
4ec2976dba Bump github.com/emiago/sipgo from 1.3.0 to 1.3.1
Bumps [github.com/emiago/sipgo](https://github.com/emiago/sipgo) from 1.3.0 to 1.3.1.
- [Release notes](https://github.com/emiago/sipgo/releases)
- [Commits](https://github.com/emiago/sipgo/compare/v1.3.0...v1.3.1)

---
updated-dependencies:
- dependency-name: github.com/emiago/sipgo
  dependency-version: 1.3.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-28 17:27:22 +00:00
dependabot[bot]
333e5d7563 Bump github.com/redis/go-redis/v9 from 9.18.0 to 9.19.0
Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.18.0 to 9.19.0.
- [Release notes](https://github.com/redis/go-redis/releases)
- [Changelog](https://github.com/redis/go-redis/blob/master/RELEASE-NOTES.md)
- [Commits](https://github.com/redis/go-redis/compare/v9.18.0...v9.19.0)

---
updated-dependencies:
- dependency-name: github.com/redis/go-redis/v9
  dependency-version: 9.19.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-28 17:27:18 +00:00
dependabot[bot]
f9da46cc51 Bump github.com/nats-io/nats-server/v2 from 2.12.7 to 2.12.8
Bumps [github.com/nats-io/nats-server/v2](https://github.com/nats-io/nats-server) from 2.12.7 to 2.12.8.
- [Release notes](https://github.com/nats-io/nats-server/releases)
- [Changelog](https://github.com/nats-io/nats-server/blob/main/RELEASES.md)
- [Commits](https://github.com/nats-io/nats-server/compare/v2.12.7...v2.12.8)

---
updated-dependencies:
- dependency-name: github.com/nats-io/nats-server/v2
  dependency-version: 2.12.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-28 17:27:12 +00:00
dependabot[bot]
28b705240d Bump modernc.org/sqlite from 1.49.1 to 1.50.0
Bumps [modernc.org/sqlite](https://gitlab.com/cznic/sqlite) from 1.49.1 to 1.50.0.
- [Changelog](https://gitlab.com/cznic/sqlite/blob/master/CHANGELOG.md)
- [Commits](https://gitlab.com/cznic/sqlite/compare/v1.49.1...v1.50.0)

---
updated-dependencies:
- dependency-name: modernc.org/sqlite
  dependency-version: 1.50.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-28 17:26:55 +00:00
Joel Wetzell
e1f1afb05a Merge pull request #138 from jwetzell/dependabot/go_modules/modernc.org/sqlite-1.49.1 2026-04-23 01:18:36 -05:00
d3b3021fd5 update SQLite version in test 2026-04-23 01:15:55 -05:00
Joel Wetzell
190c03f5dc Merge pull request #135 from jwetzell/dependabot/go_modules/github.com/nats-io/nats-server/v2-2.12.7 2026-04-23 01:12:48 -05:00
Joel Wetzell
c7d4af4747 Merge pull request #134 from jwetzell/dependabot/github_actions/docker/build-push-action-7.1.0 2026-04-23 01:12:35 -05:00
dependabot[bot]
094933a34b Bump modernc.org/sqlite from 1.48.2 to 1.49.1
Bumps [modernc.org/sqlite](https://gitlab.com/cznic/sqlite) from 1.48.2 to 1.49.1.
- [Changelog](https://gitlab.com/cznic/sqlite/blob/master/CHANGELOG.md)
- [Commits](https://gitlab.com/cznic/sqlite/compare/v1.48.2...v1.49.1)

---
updated-dependencies:
- dependency-name: modernc.org/sqlite
  dependency-version: 1.49.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-23 03:24:59 +00:00
dependabot[bot]
f40cd181e0 Bump github.com/nats-io/nats-server/v2 from 2.12.6 to 2.12.7
Bumps [github.com/nats-io/nats-server/v2](https://github.com/nats-io/nats-server) from 2.12.6 to 2.12.7.
- [Release notes](https://github.com/nats-io/nats-server/releases)
- [Changelog](https://github.com/nats-io/nats-server/blob/main/RELEASES.md)
- [Commits](https://github.com/nats-io/nats-server/compare/v2.12.6...v2.12.7)

---
updated-dependencies:
- dependency-name: github.com/nats-io/nats-server/v2
  dependency-version: 2.12.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-23 03:24:28 +00:00
Joel Wetzell
b1a35f71d2 Merge pull request #136 from jwetzell/dependabot/go_modules/modernc.org/quickjs-0.18.0
Bump modernc.org/quickjs from 0.17.2 to 0.18.0
2026-04-22 22:23:36 -05:00
Joel Wetzell
fbb16cd243 Merge pull request #137 from jwetzell/dependabot/go_modules/github.com/nats-io/nats.go-1.51.0
Bump github.com/nats-io/nats.go from 1.50.0 to 1.51.0
2026-04-22 22:23:08 -05:00
dependabot[bot]
6b9cabb976 Bump github.com/nats-io/nats.go from 1.50.0 to 1.51.0
Bumps [github.com/nats-io/nats.go](https://github.com/nats-io/nats.go) from 1.50.0 to 1.51.0.
- [Release notes](https://github.com/nats-io/nats.go/releases)
- [Commits](https://github.com/nats-io/nats.go/compare/v1.50.0...v1.51.0)

---
updated-dependencies:
- dependency-name: github.com/nats-io/nats.go
  dependency-version: 1.51.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-14 17:26:25 +00:00
dependabot[bot]
4671d41a50 Bump modernc.org/quickjs from 0.17.2 to 0.18.0
Bumps [modernc.org/quickjs](https://gitlab.com/cznic/quickjs) from 0.17.2 to 0.18.0.
- [Commits](https://gitlab.com/cznic/quickjs/compare/v0.17.2...v0.18.0)

---
updated-dependencies:
- dependency-name: modernc.org/quickjs
  dependency-version: 0.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-14 17:26:21 +00:00
dependabot[bot]
c773dd4293 Bump docker/build-push-action from 7.0.0 to 7.1.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 7.0.0 to 7.1.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](d08e5c354a...bcafcacb16)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-version: 7.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-14 17:25:49 +00:00
19 changed files with 394 additions and 328 deletions

View File

@@ -56,7 +56,7 @@ jobs:
jwetzell/showbridge
- name: Build and push
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
push: true
context: ./

View File

@@ -14,8 +14,6 @@ import (
"github.com/jwetzell/showbridge-go"
"github.com/jwetzell/showbridge-go/internal/config"
"github.com/jwetzell/showbridge-go/internal/module"
"github.com/jwetzell/showbridge-go/internal/route"
"github.com/jwetzell/showbridge-go/internal/schema"
"github.com/urfave/cli/v3"
"go.opentelemetry.io/otel"
@@ -262,7 +260,12 @@ func (app *showbridgeApp) handleChannels() {
app.routerMutex.Unlock()
continue
}
moduleErrors, routeErrors := app.router.UpdateConfig(config)
err, moduleErrors, routeErrors := app.router.UpdateConfig(config, false)
if err != nil {
app.logger.Error("failed to update router config", "error", err)
app.routerMutex.Unlock()
continue
}
app.logConfigErrors(moduleErrors, routeErrors)
app.logger.Info("configuration reloaded successfully")
app.routerMutex.Unlock()
@@ -280,7 +283,7 @@ func (app *showbridgeApp) handleChannels() {
}
}
func (app *showbridgeApp) logConfigErrors(moduleErrors []module.ModuleError, routeErrors []route.RouteError) {
func (app *showbridgeApp) logConfigErrors(moduleErrors []config.ModuleError, routeErrors []config.RouteError) {
for _, moduleError := range moduleErrors {
app.logger.Error("problem initializing module", "index", moduleError.Index, "error", moduleError.Error)
}

85
config.go Normal file
View File

@@ -0,0 +1,85 @@
package showbridge
import (
"errors"
"reflect"
"github.com/jwetzell/showbridge-go/internal/common"
"github.com/jwetzell/showbridge-go/internal/config"
"github.com/jwetzell/showbridge-go/internal/route"
)
func (r *Router) GetRunningConfig() config.Config {
r.runningConfigMu.RLock()
defer r.runningConfigMu.RUnlock()
return r.runningConfig
}
func (r *Router) UpdateConfig(newConfig config.Config, triggerChangeChan bool) (error, []config.ModuleError, []config.RouteError) {
if !r.runningConfigMu.TryLock() {
return errors.New("config update in progress"), nil, nil
}
defer r.runningConfigMu.Unlock()
oldConfig := r.runningConfig
r.logger.Debug("received config update", "oldConfig", oldConfig, "newConfig", newConfig)
if !reflect.DeepEqual(oldConfig.Api, newConfig.Api) {
r.logger.Info("applying new API config")
r.apiServer.Stop()
r.apiServer.Start(newConfig.Api)
r.runningConfig.Api = newConfig.Api
}
// TODO(jwetzell): handle config update errors better
for _, moduleInstance := range r.ModuleInstances {
moduleInstance.Stop()
}
r.logger.Debug("waiting for modules to exit")
r.moduleWait.Wait()
r.ModuleInstances = make(map[string]common.Module)
r.RouteInstances = []*route.Route{}
var moduleErrors []config.ModuleError
for moduleIndex, moduleDecl := range newConfig.Modules {
err := r.addModule(moduleDecl)
if err != nil {
if moduleErrors == nil {
moduleErrors = []config.ModuleError{}
}
moduleErrors = append(moduleErrors, config.ModuleError{
Index: moduleIndex,
Config: moduleDecl,
Error: err.Error(),
})
continue
}
}
var routeErrors []config.RouteError
for routeIndex, routeDecl := range newConfig.Routes {
err := r.addRoute(routeDecl)
if err != nil {
if routeErrors == nil {
routeErrors = []config.RouteError{}
}
routeErrors = append(routeErrors, config.RouteError{
Index: routeIndex,
Config: routeDecl,
Error: err.Error(),
})
continue
}
}
r.runningConfig = newConfig
r.startModules()
if triggerChangeChan {
r.ConfigChange <- newConfig
}
return nil, moduleErrors, routeErrors
}

View File

@@ -1,64 +1,53 @@
package showbridge
import (
"encoding/json"
"time"
"github.com/gorilla/websocket"
"github.com/jwetzell/showbridge-go/internal/common"
)
type Event struct {
Type string `json:"type"`
Data any `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
func (e Event) toJSON() ([]byte, error) {
return json.Marshal(e)
}
func (r *Router) handleEvent(event Event, sender *websocket.Conn) {
func (r *Router) HandleEvent(event common.Event, sender common.EventDestination) {
switch event.Type {
case "ping":
r.unicastEvent(Event{Type: "pong"}, sender)
r.unicastEvent(common.Event{Type: "pong", Data: map[string]any{
"timestamp": time.Now().UnixMilli(),
}}, sender)
default:
r.logger.Warn("unknown event type", "eventType", event.Type)
}
}
func (r *Router) unicastEvent(event Event, conn *websocket.Conn) {
eventJSON, err := event.toJSON()
if err != nil {
r.logger.Error("failed to marshal event to JSON", "error", err)
return
}
err = conn.WriteMessage(websocket.TextMessage, eventJSON)
if err != nil {
r.logger.Error("failed to write message to websocket connection", "error", err)
}
func (r *Router) AddEventDestination(dest common.EventDestination) {
r.eventDestinationsMu.Lock()
defer r.eventDestinationsMu.Unlock()
r.eventDestinations = append(r.eventDestinations, dest)
}
func (r *Router) broadcastEvent(event Event, excluded ...*websocket.Conn) {
eventJSON, err := event.toJSON()
if err != nil {
r.logger.Error("failed to marshal event to JSON", "error", err)
return
}
r.wsConnsMu.Lock()
defer r.wsConnsMu.Unlock()
for _, conn := range r.wsConns {
exclude := false
for _, excludedConn := range excluded {
if conn == excludedConn {
exclude = true
func (r *Router) RemoveEventDestination(dest common.EventDestination) {
r.eventDestinationsMu.Lock()
defer r.eventDestinationsMu.Unlock()
for i, d := range r.eventDestinations {
if d.Is(dest) {
r.eventDestinations = append(r.eventDestinations[:i], r.eventDestinations[i+1:]...)
break
}
}
if exclude {
continue
}
err := conn.WriteMessage(websocket.TextMessage, eventJSON)
func (r *Router) unicastEvent(event common.Event, dest common.EventDestination) {
err := dest.Send(event)
if err != nil {
r.logger.Error("failed to write message to websocket connection", "error", err)
r.logger.Error("failed to send event", "error", err)
}
}
func (r *Router) broadcastEvent(event common.Event) {
r.eventDestinationsMu.Lock()
defer r.eventDestinationsMu.Unlock()
for _, dest := range r.eventDestinations {
err := dest.Send(event)
if err != nil {
r.logger.Error("failed to send event", "error", err)
}
}
}

29
go.mod
View File

@@ -5,18 +5,18 @@ go 1.26.2
require (
github.com/eclipse/paho.mqtt.golang v1.5.1
github.com/emiago/diago v0.28.0
github.com/emiago/sipgo v1.3.0
github.com/emiago/sipgo v1.3.1
github.com/expr-lang/expr v1.17.8
github.com/extism/go-sdk v1.7.1
github.com/google/jsonschema-go v0.4.2
github.com/google/jsonschema-go v0.4.3
github.com/gorilla/websocket v1.5.3
github.com/jwetzell/artnet-go v0.2.1
github.com/jwetzell/free-d-go v0.1.0
github.com/jwetzell/osc-go v0.3.0
github.com/jwetzell/psn-go v0.3.0
github.com/nats-io/nats-server/v2 v2.12.6
github.com/nats-io/nats.go v1.50.0
github.com/redis/go-redis/v9 v9.18.0
github.com/nats-io/nats-server/v2 v2.14.0
github.com/nats-io/nats.go v1.51.0
github.com/redis/go-redis/v9 v9.19.0
github.com/urfave/cli/v3 v3.8.0
gitlab.com/gomidi/midi/v2 v2.3.23
go.bug.st/serial v1.6.4
@@ -24,17 +24,16 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.43.0
go.opentelemetry.io/otel/sdk v1.43.0
go.opentelemetry.io/otel/trace v1.43.0
modernc.org/quickjs v0.17.2
modernc.org/sqlite v1.48.2
modernc.org/quickjs v0.18.1
modernc.org/sqlite v1.50.0
sigs.k8s.io/yaml v1.6.0
)
require (
github.com/antithesishq/antithesis-sdk-go v0.6.0-default-no-op // indirect
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op // indirect
github.com/cenkalti/backoff/v5 v5.0.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/creack/goselect v0.1.2 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/dylibso/observe-sdk/go v0.0.0-20240819160327-2d926c5d788a // indirect
github.com/emiago/dtls/v3 v3.0.0-20260122183559-8b8d23e359c0 // indirect
@@ -52,7 +51,7 @@ require (
github.com/icholy/digest v1.1.0 // indirect
github.com/klauspost/compress v1.18.5 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/minio/highwayhash v1.0.4-0.20251030100505-070ab1a87a76 // indirect
github.com/minio/highwayhash v1.0.4 // indirect
github.com/nats-io/jwt/v2 v2.8.1 // indirect
github.com/nats-io/nkeys v0.4.15 // indirect
github.com/nats-io/nuid v1.0.1 // indirect
@@ -74,19 +73,19 @@ require (
go.opentelemetry.io/proto/otlp v1.10.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/crypto v0.49.0 // indirect
golang.org/x/crypto v0.50.0 // indirect
golang.org/x/net v0.52.0 // indirect
golang.org/x/sync v0.20.0 // indirect
golang.org/x/sys v0.42.0 // indirect
golang.org/x/text v0.35.0 // indirect
golang.org/x/sys v0.43.0 // indirect
golang.org/x/text v0.36.0 // indirect
golang.org/x/time v0.15.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260401024825-9d38bb4040a9 // indirect
google.golang.org/grpc v1.80.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/hraban/opus.v2 v2.0.0-20230925203106-0188a62cb302 // indirect
modernc.org/libc v1.70.0 // indirect
modernc.org/libquickjs v0.12.4 // indirect
modernc.org/libc v1.72.1 // indirect
modernc.org/libquickjs v0.12.6 // indirect
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect
)

86
go.sum
View File

@@ -1,5 +1,5 @@
github.com/antithesishq/antithesis-sdk-go v0.6.0-default-no-op h1:kpBdlEPbRvff0mDD1gk7o9BhI16b9p5yYAXRlidpqJE=
github.com/antithesishq/antithesis-sdk-go v0.6.0-default-no-op/go.mod h1:IUpT2DPAKh6i/YhSbt6Gl3v2yvUZjmKncl7U91fup7E=
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op h1:Z/MZK75wC/NSrkgqeNIa7jexam9uWzhLmFTSCPI/kn0=
github.com/antithesishq/antithesis-sdk-go v0.7.0-default-no-op/go.mod h1:FQyySiasQQM8735Ddel3MRojmy4dA1IqCeyJ5jmPMbI=
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
@@ -12,8 +12,6 @@ github.com/creack/goselect v0.1.2 h1:2DNy14+JPjRBgPzAd1thbQp4BSIihxcBf0IXhQXDRa0
github.com/creack/goselect v0.1.2/go.mod h1:a/NhLweNvqIYMuxcMOuWY516Cimucms3DglDzQP3hKY=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/dylibso/observe-sdk/go v0.0.0-20240819160327-2d926c5d788a h1:UwSIFv5g5lIvbGgtf3tVwC7Ky9rmMFBp0RMs+6f6YqE=
@@ -24,8 +22,8 @@ github.com/emiago/diago v0.28.0 h1:VCiimhFYLoBTsxH6WrufLSt6tKWG8Fv7LfCkZHqct2E=
github.com/emiago/diago v0.28.0/go.mod h1:eQT6j9co9PMQ/25aUiM2jpvwxxWFXLWi2w5R3lZNmKg=
github.com/emiago/dtls/v3 v3.0.0-20260122183559-8b8d23e359c0 h1:o4LxpUnZ1zxiQ+Qjc9kLwXcjz31NGAHmnZ7xoJto3VM=
github.com/emiago/dtls/v3 v3.0.0-20260122183559-8b8d23e359c0/go.mod h1:ydcZ977eS1I6uOWodzMuw30BwvNAzT9su/xcNYSJqjA=
github.com/emiago/sipgo v1.3.0 h1:efxQln1wJqcIU9+N+4eTKNtTZ7YsRsg8yc+0XYqyuQU=
github.com/emiago/sipgo v1.3.0/go.mod h1:DuwAxBZhKMqIzQFPGZb1MVAGU6Wuxj64oTOhd5dx/FY=
github.com/emiago/sipgo v1.3.1 h1:JwcmYJtCmcjuLwB2ZxtupYilNQgwXN/JIcxp+CDq16A=
github.com/emiago/sipgo v1.3.1/go.mod h1:DuwAxBZhKMqIzQFPGZb1MVAGU6Wuxj64oTOhd5dx/FY=
github.com/expr-lang/expr v1.17.8 h1:W1loDTT+0PQf5YteHSTpju2qfUfNoBt4yw9+wOEU9VM=
github.com/expr-lang/expr v1.17.8/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4=
github.com/extism/go-sdk v1.7.1 h1:lWJos6uY+tRFdlIHR+SJjwFDApY7OypS/2nMhiVQ9Sw=
@@ -51,8 +49,8 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/go-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo=
github.com/google/go-tpm v0.9.8/go.mod h1:h9jEsEECg7gtLis0upRBQU+GhYVH6jMjrFxI8u6bVUY=
github.com/google/jsonschema-go v0.4.2 h1:tmrUohrwoLZZS/P3x7ex0WAVknEkBZM46iALbcqoRA8=
github.com/google/jsonschema-go v0.4.2/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
github.com/google/jsonschema-go v0.4.3 h1:/DBOLZTfDow7pe2GmaJNhltueGTtDKICi8V8p+DQPd0=
github.com/google/jsonschema-go v0.4.3/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e h1:ijClszYn+mADRFY17kjQEVQ1XRhq2/JR1M3sGqeJoxs=
github.com/google/pprof v0.0.0-20250317173921-a4b03ec1a45e/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
@@ -77,22 +75,22 @@ github.com/jwetzell/psn-go v0.3.0 h1:WVpCEmExYE8a+I5hQak5jNJJp2x35VdGX/VuMUKPmhY
github.com/jwetzell/psn-go v0.3.0/go.mod h1:bcEAeti4sQM375buujb3mIfmUstD4Aby18gq3ENb6+o=
github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE=
github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ=
github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/minio/highwayhash v1.0.4-0.20251030100505-070ab1a87a76 h1:KGuD/pM2JpL9FAYvBrnBBeENKZNh6eNtjqytV6TYjnk=
github.com/minio/highwayhash v1.0.4-0.20251030100505-070ab1a87a76/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ=
github.com/minio/highwayhash v1.0.4 h1:asJizugGgchQod2ja9NJlGOWq4s7KsAWr5XUc9Clgl4=
github.com/minio/highwayhash v1.0.4/go.mod h1:GGYsuwP/fPD6Y9hMiXuapVvlIUEhFhMTh0rxU3ik1LQ=
github.com/nats-io/jwt/v2 v2.8.1 h1:V0xpGuD/N8Mi+fQNDynXohVvp7ZztevW5io8CUWlPmU=
github.com/nats-io/jwt/v2 v2.8.1/go.mod h1:nWnOEEiVMiKHQpnAy4eXlizVEtSfzacZ1Q43LIRavZg=
github.com/nats-io/nats-server/v2 v2.12.6 h1:Egbx9Vl7Ch8wTtpXPGqbehkZ+IncKqShUxvrt1+Enc8=
github.com/nats-io/nats-server/v2 v2.12.6/go.mod h1:4HPlrvtmSO3yd7KcElDNMx9kv5EBJBnJJzQPptXlheo=
github.com/nats-io/nats.go v1.50.0 h1:5zAeQrTvyrKrWLJ0fu02W3br8ym57qf7csDzgLOpcds=
github.com/nats-io/nats.go v1.50.0/go.mod h1:26HypzazeOkyO3/mqd1zZd53STJN0EjCYF9Uy2ZOBno=
github.com/nats-io/nats-server/v2 v2.14.0 h1:+8q0HrDFotwLLcGH/legOEOnowunhK+aZ4GYBIWpQlM=
github.com/nats-io/nats-server/v2 v2.14.0/go.mod h1:ImVUUDvfClJbb6cuJQRc1VmgDCXKM5ds0OoiG9MVOKo=
github.com/nats-io/nats.go v1.51.0 h1:ByW84XTz6W03GSSsygsZcA+xgKK8vPGaa/FCAAEHnAI=
github.com/nats-io/nats.go v1.51.0/go.mod h1:26HypzazeOkyO3/mqd1zZd53STJN0EjCYF9Uy2ZOBno=
github.com/nats-io/nkeys v0.4.15 h1:JACV5jRVO9V856KOapQ7x+EY8Jo3qw1vJt/9Jpwzkk4=
github.com/nats-io/nkeys v0.4.15/go.mod h1:CpMchTXC9fxA5zrMo4KpySxNjiDVvr8ANOSZdiNfUrs=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
@@ -115,8 +113,8 @@ github.com/pion/transport/v4 v4.0.1 h1:sdROELU6BZ63Ab7FrOLn13M6YdJLY20wldXW2Cu2k
github.com/pion/transport/v4 v4.0.1/go.mod h1:nEuEA4AD5lPdcIegQDpVLgNoDGreqM/YqmEx3ovP4jM=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/redis/go-redis/v9 v9.18.0 h1:pMkxYPkEbMPwRdenAzUNyFNrDgHx9U+DrBabWNfSRQs=
github.com/redis/go-redis/v9 v9.18.0/go.mod h1:k3ufPphLU5YXwNTUcCRXGxUoF1fqxnhFQmscfkCoDA0=
github.com/redis/go-redis/v9 v9.19.0 h1:XPVaaPSnG6RhYf7p+rmSa9zZfeVAnWsH5h3lxthOm/k=
github.com/redis/go-redis/v9 v9.19.0/go.mod h1:v/M13XI1PVCDcm01VtPFOADfZtHf8YW3baQf57KlIkA=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
@@ -131,8 +129,8 @@ github.com/urfave/cli/v3 v3.8.0 h1:XqKPrm0q4P0q5JpoclYoCAv0/MIvH/jZ2umzuf8pNTI=
github.com/urfave/cli/v3 v3.8.0/go.mod h1:ysVLtOEmg2tOy6PknnYVhDoouyC/6N42TMeoMzskhso=
github.com/zaf/g711 v1.4.0 h1:XZYkjjiAg9QTBnHqEg37m2I9q3IIDv5JRYXs2N8ma7c=
github.com/zaf/g711 v1.4.0/go.mod h1:eCDXt3dSp/kYYAoooba7ukD/Q75jvAaS4WOMr0l1Roo=
github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs=
github.com/zeebo/xxh3 v1.1.0/go.mod h1:IisAie1LELR4xhVinxWS5+zf1lA4p0MW4T+w+W07F5s=
gitlab.com/gomidi/midi/v2 v2.3.23 h1:P8NxV4EzV9c+BjpwTeB+G/qa+Xdq/UTazS2fKxY0O0g=
gitlab.com/gomidi/midi/v2 v2.3.23/go.mod h1:jDpP4O4skYi+7iVwt6Zyp18bd2M4hkjtMuw2cmgKgfw=
go.bug.st/serial v1.6.4 h1:7FmqNPgVp3pu2Jz5PoPtbZ9jJO5gnEnZIvnI1lzve8A=
@@ -163,24 +161,24 @@ go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
golang.org/x/mod v0.33.0 h1:tHFzIWbBifEmbwtGz65eaWyGiGZatSrT9prnU8DbVL8=
golang.org/x/mod v0.33.0/go.mod h1:swjeQEj+6r7fODbD2cqrnje9PnziFuw4bmLbBZFrQ5w=
golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI=
golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q=
golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI=
golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY=
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI=
golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg=
golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164=
golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
golang.org/x/tools v0.42.0 h1:uNgphsn75Tdz5Ji2q36v/nsFSfR/9BRFvqhGBaJGd5k=
golang.org/x/tools v0.42.0/go.mod h1:Ma6lCIwGZvHK6XtgbswSoWroEkhugApmsXyrUmBhfr0=
golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s=
golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0=
gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4=
gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E=
google.golang.org/genproto/googleapis/api v0.0.0-20260401024825-9d38bb4040a9 h1:VPWxll4HlMw1Vs/qXtN7BvhZqsS9cdAittCNvVENElA=
@@ -200,10 +198,10 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools/v3 v3.5.2 h1:7koQfIKdy+I8UTetycgUqXWSDwpgv193Ka+qRsmBY8Q=
gotest.tools/v3 v3.5.2/go.mod h1:LtdLGcnqToBH83WByAAi/wiwSFCArdFIUV/xxN4pcjA=
modernc.org/cc/v4 v4.27.1 h1:9W30zRlYrefrDV2JE2O8VDtJ1yPGownxciz5rrbQZis=
modernc.org/cc/v4 v4.27.1/go.mod h1:uVtb5OGqUKpoLWhqwNQo/8LwvoiEBLvZXIQ/SmO6mL0=
modernc.org/ccgo/v4 v4.32.0 h1:hjG66bI/kqIPX1b2yT6fr/jt+QedtP2fqojG2VrFuVw=
modernc.org/ccgo/v4 v4.32.0/go.mod h1:6F08EBCx5uQc38kMGl+0Nm0oWczoo1c7cgpzEry7Uc0=
modernc.org/cc/v4 v4.28.1 h1:XpLbkYVQ24E8tX5u8+yWGvaxerxkR/S4zqxI8ZoSBuc=
modernc.org/cc/v4 v4.28.1/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
modernc.org/ccgo/v4 v4.34.0 h1:yRLPFZieg532OT4rp4JFNIVcquwalMX26G95WQDqwCQ=
modernc.org/ccgo/v4 v4.34.0/go.mod h1:AS5WYMyBakQ+fhsHhtP8mWB82KTGPkNNJDGfGQCe0/A=
modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM=
modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU=
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
@@ -212,22 +210,22 @@ modernc.org/gc/v3 v3.1.2 h1:ZtDCnhonXSZexk/AYsegNRV1lJGgaNZJuKjJSWKyEqo=
modernc.org/gc/v3 v3.1.2/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY=
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
modernc.org/libc v1.70.0 h1:U58NawXqXbgpZ/dcdS9kMshu08aiA6b7gusEusqzNkw=
modernc.org/libc v1.70.0/go.mod h1:OVmxFGP1CI/Z4L3E0Q3Mf1PDE0BucwMkcXjjLntvHJo=
modernc.org/libquickjs v0.12.4 h1:WQ2XP6pAscvtHKPEVuHTf8NiAl5nMomKgIL6790r7AQ=
modernc.org/libquickjs v0.12.4/go.mod h1:MqdjijqGUwLw+r86+YbFLLj7vKZhVHEKRs8XOsnM/n8=
modernc.org/libc v1.72.1 h1:db1xwJ6u1kE3KHTFTTbe2GCrczHPKzlURP0aDC4NGD0=
modernc.org/libc v1.72.1/go.mod h1:HRMiC/PhPGLIPM7GzAFCbI+oSgE3dhZ8FWftmRrHVlY=
modernc.org/libquickjs v0.12.6 h1:TlABTRLKOFLeY3NxkoHZeLzGBTreA2a3DhmReVON23s=
modernc.org/libquickjs v0.12.6/go.mod h1:ajFW8dWHtF8ggFWGbU2BBEM6FI0vemVWrd8nEHAPZpE=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
modernc.org/opt v0.1.4 h1:2kNGMRiUjrp4LcaPuLY2PzUfqM/w9N23quVwhKt5Qm8=
modernc.org/opt v0.1.4/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
modernc.org/quickjs v0.17.2 h1:LrhCQ763clXttVFFYdfnwAATM4JFv/vPKee/tLsFFIE=
modernc.org/quickjs v0.17.2/go.mod h1:h8zcP/sP8AZkDvtMXwIoUV/g5pWTPqivz0PLU070URQ=
modernc.org/opt v0.2.0 h1:tGyef5ApycA7FSEOMraay9SaTk5zmbx7Tu+cJs4QKZg=
modernc.org/opt v0.2.0/go.mod h1:03fq9lsNfvkYSfxrfUhZCWPk1lm4cq4N+Bh//bEtgns=
modernc.org/quickjs v0.18.1 h1:exrw1Bp1smLUVXiZ4M9yfUP24EeU1C2wCKD1IHN2JFk=
modernc.org/quickjs v0.18.1/go.mod h1:wMyqS7/VurEMUms6XwVQoX7UhJakAr9EMc8aPSL5Xjc=
modernc.org/sortutil v1.2.1 h1:+xyoGf15mM3NMlPDnFqrteY07klSFxLElE2PVuWIJ7w=
modernc.org/sortutil v1.2.1/go.mod h1:7ZI3a3REbai7gzCLcotuw9AC4VZVpYMjDzETGsSMqJE=
modernc.org/sqlite v1.48.2 h1:5CnW4uP8joZtA0LedVqLbZV5GD7F/0x91AXeSyjoh5c=
modernc.org/sqlite v1.48.2/go.mod h1:hWjRO6Tj/5Ik8ieqxQybiEOUXy0NJFNp2tpvVpKlvig=
modernc.org/sqlite v1.50.0 h1:eMowQSWLK0MeiQTdmz3lqoF5dqclujdlIKeJA11+7oM=
modernc.org/sqlite v1.50.0/go.mod h1:m0w8xhwYUVY3H6pSDwc3gkJ/irZT/0YEXwBlhaxQEew=
modernc.org/strutil v1.2.1 h1:UneZBkQA+DX2Rp35KcM69cSsNES9ly8mQWD71HKlOA0=
modernc.org/strutil v1.2.1/go.mod h1:EHkiggD70koQxjVdSBM3JKM7k6L0FbGE5eymy9i3B9A=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=

View File

@@ -1,4 +1,4 @@
package showbridge
package api
import (
"context"
@@ -6,60 +6,80 @@ import (
"encoding/json"
"fmt"
"io"
"log/slog"
"net/http"
"sync"
"time"
"github.com/jwetzell/showbridge-go/internal/common"
"github.com/jwetzell/showbridge-go/internal/config"
"github.com/jwetzell/showbridge-go/internal/module"
"github.com/jwetzell/showbridge-go/internal/route"
"github.com/jwetzell/showbridge-go/internal/schema"
)
func (r *Router) startAPIServer(config config.ApiConfig) {
if !config.Enabled {
r.logger.Warn("API not enabled")
type ApiServer struct {
config config.ApiConfig
serverMu sync.Mutex
server *http.Server
shutdown context.CancelFunc
logger *slog.Logger
configurableRouter config.Configurable
eventRouter common.EventRouter
}
func NewApiServer(configurableRouter config.Configurable, eventRouter common.EventRouter) *ApiServer {
return &ApiServer{
configurableRouter: configurableRouter,
eventRouter: eventRouter,
logger: slog.Default().With("component", "api"),
}
}
func (as *ApiServer) Start(config config.ApiConfig) {
as.config = config
if !as.config.Enabled {
as.logger.Warn("not enabled")
return
}
r.logger.Debug("starting API server", "port", config.Port)
as.logger.Debug("starting", "port", as.config.Port)
mux := http.NewServeMux()
mux.HandleFunc("/ws", r.handleWebsocket)
mux.HandleFunc("/health", r.handleHealthHTTP)
mux.HandleFunc("/api/v1/config", r.handleConfigHTTP)
mux.HandleFunc("/ws", as.handleWebsocket)
mux.HandleFunc("/health", as.handleHealthHTTP)
mux.HandleFunc("/api/v1/config", as.handleConfigHTTP)
mux.HandleFunc("/schema/config.schema.json", handleConfigSchema)
mux.HandleFunc("/schema/routes.schema.json", handleRoutesSchema)
mux.HandleFunc("/schema/modules.schema.json", handleModulesSchema)
mux.HandleFunc("/schema/processors.schema.json", handleProcessorsSchema)
r.apiServerMu.Lock()
defer r.apiServerMu.Unlock()
r.apiServer = &http.Server{
Addr: fmt.Sprintf(":%d", config.Port),
as.serverMu.Lock()
defer as.serverMu.Unlock()
as.server = &http.Server{
Addr: fmt.Sprintf(":%d", as.config.Port),
Handler: mux,
}
go func() {
r.apiServer.ListenAndServe()
r.apiServerShutdown()
as.server.ListenAndServe()
as.shutdown()
}()
}
func (r *Router) stopAPIServer() {
if r.apiServer == nil {
func (as *ApiServer) Stop() {
if as.server == nil {
return
}
r.logger.Debug("stopping API server")
r.apiServerMu.Lock()
defer r.apiServerMu.Unlock()
if r.apiServer != nil {
as.logger.Debug("stopping")
as.serverMu.Lock()
defer as.serverMu.Unlock()
if as.server != nil {
apiShutdownCtx, apiShutdownCancel := context.WithTimeout(context.Background(), 5*time.Second)
r.apiServerShutdown = apiShutdownCancel
r.apiServer.Shutdown(apiShutdownCtx)
as.shutdown = apiShutdownCancel
as.server.Shutdown(apiShutdownCtx)
<-apiShutdownCtx.Done()
r.apiServer = nil
as.server = nil
}
}
func (r *Router) handleHealthHTTP(w http.ResponseWriter, req *http.Request) {
func (as *ApiServer) handleHealthHTTP(w http.ResponseWriter, req *http.Request) {
switch req.Method {
case http.MethodGet:
w.Header().Set("Access-Control-Allow-Origin", "*")
@@ -75,11 +95,11 @@ func (r *Router) handleHealthHTTP(w http.ResponseWriter, req *http.Request) {
}
}
func (r *Router) handleConfigHTTP(w http.ResponseWriter, req *http.Request) {
func (as *ApiServer) handleConfigHTTP(w http.ResponseWriter, req *http.Request) {
switch req.Method {
case http.MethodGet:
configJSON, err := json.Marshal(r.runningConfig)
configJSON, err := json.Marshal(as.configurableRouter.GetRunningConfig())
if err != nil {
http.Error(w, "Internal server error", http.StatusInternalServerError)
return
@@ -89,10 +109,6 @@ func (r *Router) handleConfigHTTP(w http.ResponseWriter, req *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.Write(configJSON)
case http.MethodPut:
if r.updatingConfig {
http.Error(w, "Config update in progress.", http.StatusConflict)
return
}
//TODO(jwetzell): again way too much marshaling
cfgBytes, err := io.ReadAll(req.Body)
if err != nil {
@@ -132,11 +148,15 @@ func (r *Router) handleConfigHTTP(w http.ResponseWriter, req *http.Request) {
http.Error(w, "Bad request", http.StatusBadRequest)
return
}
moduleErrors, routeErrors := r.UpdateConfig(newConfig)
err, moduleErrors, routeErrors := as.configurableRouter.UpdateConfig(newConfig, true)
if err != nil {
http.Error(w, err.Error(), http.StatusConflict)
return
}
if len(moduleErrors) > 0 || len(routeErrors) > 0 {
errorResponse := struct {
ModuleErrors []module.ModuleError `json:"moduleErrors,omitempty"`
RouteErrors []route.RouteError `json:"routeErrors,omitempty"`
ModuleErrors []config.ModuleError `json:"moduleErrors,omitempty"`
RouteErrors []config.RouteError `json:"routeErrors,omitempty"`
}{
ModuleErrors: moduleErrors,
RouteErrors: routeErrors,
@@ -154,7 +174,6 @@ func (r *Router) handleConfigHTTP(w http.ResponseWriter, req *http.Request) {
}
w.Header().Set("Access-Control-Allow-Origin", "*")
w.WriteHeader(http.StatusOK)
r.ConfigChange <- newConfig
case http.MethodOptions:
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Access-Control-Allow-Methods", "GET, PUT, OPTIONS")

82
internal/api/websocket.go Normal file
View File

@@ -0,0 +1,82 @@
package api
import (
"encoding/json"
"net/http"
"github.com/gorilla/websocket"
"github.com/jwetzell/showbridge-go/internal/common"
)
var upgrader = websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool {
return true
},
}
type WebsocketEventDestination struct {
conn *websocket.Conn
}
func (d WebsocketEventDestination) Send(event common.Event) error {
eventJSON, err := event.ToJSON()
if err != nil {
return err
}
return d.conn.WriteMessage(websocket.TextMessage, eventJSON)
}
func (d WebsocketEventDestination) Is(dest common.EventDestination) bool {
other, ok := dest.(WebsocketEventDestination)
if !ok {
return false
}
return d.conn == other.conn
}
func (as *ApiServer) handleWebsocket(w http.ResponseWriter, req *http.Request) {
conn, err := upgrader.Upgrade(w, req, nil)
if err != nil {
as.logger.Error("websocket upgrade error", "error", err)
return
}
defer conn.Close()
eventDestination := WebsocketEventDestination{conn: conn}
as.eventRouter.AddEventDestination(eventDestination)
READ_LOOP:
for {
messageType, message, err := conn.ReadMessage()
if err != nil {
_, ok := err.(*websocket.CloseError)
if ok {
break READ_LOOP
}
}
switch messageType {
case websocket.TextMessage, websocket.BinaryMessage:
event := common.Event{}
err = json.Unmarshal(message, &event)
if err != nil {
as.logger.Error("websocket message unmarshal error", "error", err)
continue
}
as.eventRouter.HandleEvent(event, WebsocketEventDestination{conn: conn})
case websocket.CloseMessage:
break READ_LOOP
case websocket.PingMessage:
err = conn.WriteMessage(websocket.PongMessage, nil)
if err != nil {
as.logger.Error("websocket pong error", "error", err)
}
default:
as.logger.Warn("unsupported websocket message type", "type", messageType)
continue
}
}
//NOTE(jwetzell): remove ws connection
as.eventRouter.RemoveEventDestination(eventDestination)
}

26
internal/common/events.go Normal file
View File

@@ -0,0 +1,26 @@
package common
import (
"encoding/json"
)
type Event struct {
Type string `json:"type"`
Data any `json:"data,omitempty"`
Error string `json:"error,omitempty"`
}
func (e Event) ToJSON() ([]byte, error) {
return json.Marshal(e)
}
type EventDestination interface {
Send(event Event) error
Is(dest EventDestination) bool
}
type EventRouter interface {
HandleEvent(event Event, source EventDestination)
AddEventDestination(dest EventDestination)
RemoveEventDestination(dest EventDestination)
}

View File

@@ -1,6 +1,8 @@
package common
import "context"
import (
"context"
)
type RouteIO interface {
HandleInput(ctx context.Context, sourceId string, payload any) (bool, []RouteIOError)

View File

@@ -5,3 +5,8 @@ type Config struct {
Modules []ModuleConfig `json:"modules"`
Routes []RouteConfig `json:"routes"`
}
type Configurable interface {
UpdateConfig(newConfig Config, triggerChangeChannel bool) (error, []ModuleError, []RouteError)
GetRunningConfig() Config
}

View File

@@ -5,3 +5,9 @@ type ModuleConfig struct {
Type string `json:"type"`
Params Params `json:"params,omitempty"`
}
type ModuleError struct {
Index int `json:"index"`
Config ModuleConfig `json:"config"`
Error string `json:"error"`
}

View File

@@ -4,3 +4,9 @@ type RouteConfig struct {
Input string `json:"input"`
Processors []ProcessorConfig `json:"processors"`
}
type RouteError struct {
Index int `json:"index"`
Config RouteConfig `json:"config"`
Error string `json:"error"`
}

View File

@@ -10,12 +10,6 @@ import (
"github.com/jwetzell/showbridge-go/internal/config"
)
type ModuleError struct {
Index int `json:"index"`
Config config.ModuleConfig `json:"config"`
Error string `json:"error"`
}
type ModuleRegistration struct {
Type string `json:"type"`
Title string `json:"title,omitempty"`

View File

@@ -34,7 +34,7 @@ func TestDbQueryFromRegistry(t *testing.T) {
}
payload := "hello"
expected := map[string]any{"sqlite_version()": "3.51.3"}
expected := map[string]any{"sqlite_version()": "3.53.0"}
got, err := processorInstance.Process(t.Context(), common.GetWrappedPayload(test.GetContextWithModules(
t.Context(),

View File

@@ -13,11 +13,6 @@ import (
"go.opentelemetry.io/otel/trace"
)
type RouteError struct {
Index int `json:"index"`
Config config.RouteConfig `json:"config"`
Error string `json:"error"`
}
type Route struct {
input string
processors []processor.Processor

119
router.go
View File

@@ -4,11 +4,9 @@ import (
"context"
"errors"
"log/slog"
"net/http"
"reflect"
"sync"
"github.com/gorilla/websocket"
"github.com/jwetzell/showbridge-go/internal/api"
"github.com/jwetzell/showbridge-go/internal/common"
"github.com/jwetzell/showbridge-go/internal/config"
"github.com/jwetzell/showbridge-go/internal/module"
@@ -20,7 +18,7 @@ import (
"go.opentelemetry.io/otel/trace"
)
// TODO(jwetzell): can/should this be split into different components?
// TODO(jwetzell): can/should this be split into different "components"?
type Router struct {
contextCancel context.CancelFunc
Context context.Context
@@ -33,12 +31,9 @@ type Router struct {
logger *slog.Logger
runningConfig config.Config
runningConfigMu sync.RWMutex
wsConns []*websocket.Conn
wsConnsMu sync.Mutex
apiServer *http.Server
apiServerMu sync.Mutex
apiServerShutdown context.CancelFunc
updatingConfig bool
apiServer *api.ApiServer
eventDestinations []common.EventDestination
eventDestinationsMu sync.Mutex
}
func (r *Router) addModule(moduleDecl config.ModuleConfig) error {
@@ -115,7 +110,7 @@ func (r *Router) getModule(moduleId string) common.Module {
return moduleInstance
}
func NewRouter(routerConfig config.Config) (*Router, []module.ModuleError, []route.RouteError) {
func NewRouter(routerConfig config.Config) (*Router, []config.ModuleError, []config.RouteError) {
router := Router{
ModuleInstances: make(map[string]common.Module),
@@ -123,20 +118,19 @@ func NewRouter(routerConfig config.Config) (*Router, []module.ModuleError, []rou
ConfigChange: make(chan config.Config, 1),
logger: slog.Default().With("component", "router"),
runningConfig: routerConfig,
updatingConfig: false,
}
router.logger.Debug("creating")
var moduleErrors []module.ModuleError
var moduleErrors []config.ModuleError
for moduleIndex, moduleDecl := range routerConfig.Modules {
err := router.addModule(moduleDecl)
if err != nil {
if moduleErrors == nil {
moduleErrors = []module.ModuleError{}
moduleErrors = []config.ModuleError{}
}
moduleErrors = append(moduleErrors, module.ModuleError{
moduleErrors = append(moduleErrors, config.ModuleError{
Index: moduleIndex,
Config: moduleDecl,
Error: err.Error(),
@@ -146,14 +140,14 @@ func NewRouter(routerConfig config.Config) (*Router, []module.ModuleError, []rou
}
var routeErrors []route.RouteError
var routeErrors []config.RouteError
for routeIndex, routeDecl := range routerConfig.Routes {
err := router.addRoute(routeDecl)
if err != nil {
if routeErrors == nil {
routeErrors = []route.RouteError{}
routeErrors = []config.RouteError{}
}
routeErrors = append(routeErrors, route.RouteError{
routeErrors = append(routeErrors, config.RouteError{
Index: routeIndex,
Config: routeDecl,
Error: err.Error(),
@@ -162,6 +156,10 @@ func NewRouter(routerConfig config.Config) (*Router, []module.ModuleError, []rou
}
}
apiServer := api.NewApiServer(&router, &router)
router.apiServer = apiServer
return &router, moduleErrors, routeErrors
}
@@ -171,10 +169,10 @@ func (r *Router) Start(ctx context.Context) {
r.Context = routerContext
r.contextCancel = cancel
r.startModules()
r.startAPIServer(r.runningConfig.Api)
r.apiServer.Start(r.GetRunningConfig().Api)
<-r.Context.Done()
r.logger.Debug("shutting down api server")
r.stopAPIServer()
r.apiServer.Stop()
r.logger.Debug("waiting for modules to exit")
r.moduleWait.Wait()
r.logger.Info("done")
@@ -194,7 +192,7 @@ func (r *Router) HandleInput(ctx context.Context, sourceId string, payload any)
var routeIOErrors []common.RouteIOError
routeFound := false
r.broadcastEvent(Event{
r.broadcastEvent(common.Event{
Type: "input",
Data: map[string]any{
"source": sourceId,
@@ -227,7 +225,7 @@ func (r *Router) HandleInput(ctx context.Context, sourceId string, payload any)
Index: routeIndex,
ProcessError: err,
})
r.broadcastEvent(Event{
r.broadcastEvent(common.Event{
Type: "route",
Data: map[string]any{
"index": routeIndex,
@@ -236,7 +234,7 @@ func (r *Router) HandleInput(ctx context.Context, sourceId string, payload any)
})
return
}
r.broadcastEvent(Event{
r.broadcastEvent(common.Event{
Type: "route",
Data: map[string]any{
"index": routeIndex,
@@ -253,7 +251,7 @@ func (r *Router) HandleInput(ctx context.Context, sourceId string, payload any)
func (r *Router) HandleOutput(ctx context.Context, destinationId string, payload any) error {
spanCtx, span := otel.Tracer("router").Start(ctx, "output", trace.WithAttributes(attribute.String("destination.id", destinationId)))
defer span.End()
outputEvent := Event{
outputEvent := common.Event{
Type: "output",
Data: map[string]any{
"destination": destinationId,
@@ -310,76 +308,3 @@ func (r *Router) startModules() {
}
}
}
func (r *Router) RunningConfig() config.Config {
r.runningConfigMu.RLock()
defer r.runningConfigMu.RLock()
return r.runningConfig
}
func (r *Router) UpdateConfig(newConfig config.Config) ([]module.ModuleError, []route.RouteError) {
r.runningConfigMu.Lock()
defer r.runningConfigMu.Unlock()
r.updatingConfig = true
defer func() {
r.updatingConfig = false
}()
oldConfig := r.runningConfig
r.logger.Debug("received config update", "oldConfig", oldConfig, "newConfig", newConfig)
if !reflect.DeepEqual(oldConfig.Api, newConfig.Api) {
r.logger.Info("applying new API config")
r.stopAPIServer()
r.startAPIServer(newConfig.Api)
r.runningConfig.Api = newConfig.Api
}
// TODO(jwetzell): handle config update errors better
for _, moduleInstance := range r.ModuleInstances {
moduleInstance.Stop()
}
r.logger.Debug("waiting for modules to exit")
r.moduleWait.Wait()
r.ModuleInstances = make(map[string]common.Module)
r.RouteInstances = []*route.Route{}
var moduleErrors []module.ModuleError
for moduleIndex, moduleDecl := range newConfig.Modules {
err := r.addModule(moduleDecl)
if err != nil {
if moduleErrors == nil {
moduleErrors = []module.ModuleError{}
}
moduleErrors = append(moduleErrors, module.ModuleError{
Index: moduleIndex,
Config: moduleDecl,
Error: err.Error(),
})
continue
}
}
var routeErrors []route.RouteError
for routeIndex, routeDecl := range newConfig.Routes {
err := r.addRoute(routeDecl)
if err != nil {
if routeErrors == nil {
routeErrors = []route.RouteError{}
}
routeErrors = append(routeErrors, route.RouteError{
Index: routeIndex,
Config: routeDecl,
Error: err.Error(),
})
continue
}
}
r.runningConfig = newConfig
r.startModules()
return moduleErrors, routeErrors
}

View File

@@ -91,8 +91,8 @@ func TestNewRouter(t *testing.T) {
t.Fatalf("router should not have returned any route errors: %v", routeErrors)
}
if !reflect.DeepEqual(routerConfig, router.RunningConfig()) {
t.Fatalf("router running config did not match expected, got: %v, expected: %v", router.RunningConfig(), routerConfig)
if !reflect.DeepEqual(routerConfig, router.GetRunningConfig()) {
t.Fatalf("router running config did not match expected, got: %v, expected: %v", router.GetRunningConfig(), routerConfig)
}
}

View File

@@ -1,68 +0,0 @@
package showbridge
import (
"encoding/json"
"net/http"
"github.com/gorilla/websocket"
)
var upgrader = websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool {
return true
},
}
func (r *Router) handleWebsocket(w http.ResponseWriter, req *http.Request) {
conn, err := upgrader.Upgrade(w, req, nil)
if err != nil {
r.logger.Error("websocket upgrade error", "error", err)
return
}
defer conn.Close()
r.wsConnsMu.Lock()
r.wsConns = append(r.wsConns, conn)
r.wsConnsMu.Unlock()
READ_LOOP:
for {
messageType, message, err := conn.ReadMessage()
if err != nil {
_, ok := err.(*websocket.CloseError)
if ok {
break READ_LOOP
}
}
switch messageType {
case websocket.TextMessage, websocket.BinaryMessage:
event := Event{}
err = json.Unmarshal(message, &event)
if err != nil {
r.logger.Error("websocket message unmarshal error", "error", err)
continue
}
r.handleEvent(event, conn)
case websocket.CloseMessage:
break READ_LOOP
case websocket.PingMessage:
err = conn.WriteMessage(websocket.PongMessage, nil)
if err != nil {
r.logger.Error("websocket pong error", "error", err)
}
default:
r.logger.Warn("unsupported websocket message type", "type", messageType)
continue
}
}
//NOTE(jwetzell): remove ws connection
r.wsConnsMu.Lock()
for i, c := range r.wsConns {
if c == conn {
r.wsConns = append(r.wsConns[:i], r.wsConns[i+1:]...)
break
}
}
r.wsConnsMu.Unlock()
}