Refactor config format and improve consistency

Config changes:
- Use protocol prefixes in addresses: "sacn:64:361-450" -> "artnet:0.0.0:1"
- Remove separate from_proto/proto fields
- Targets now include protocol: universe = "artnet:0.0.0"

CLI changes:
- Rename --listen to --artnet-listen (empty to disable)
- Fix --debug help text

Logging changes:
- Use [<-proto] and [->proto] prefixes for direction
- Consistent lowercase key=value format
- Refactor duplicate send code into sendOutputs()

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ian Gulliver
2025-12-22 18:22:09 -08:00
parent 86403f1ff8
commit e823d9838d
4 changed files with 160 additions and 174 deletions

View File

@@ -1,77 +1,68 @@
# artmap configuration
# Run with: go run . -config config.toml [-listen :6454]
# Run with: go run . -config config.toml [-artnet-listen :6454]
# Target addresses for ArtNet output universes
# Configure the destination IP (broadcast or unicast) for each output universe
# Each output universe needs a target IP (broadcast or unicast)
# ArtPoll discovery will be sent to all unique target addresses
[[target]]
universe = "0.0.0"
universe = "artnet:0.0.0"
address = "2.255.255.255"
[[target]]
universe = "0.0.5"
universe = "artnet:0.0.5"
address = "10.50.255.255"
# Address format:
# from: universe[:channels] - range specifies which channels to read
# to: universe[:channel] - single channel specifies where to start writing
# proto:universe[:channels]
#
# Protocol prefix (required):
# artnet: - ArtNet protocol
# sacn: - sACN/E1.31 protocol
#
# Universe: "net.subnet.universe" or plain number (all 0-indexed, 0-127.0-15.0-15)
# Channels: 1-indexed (1-512), matching DMX convention
#
# From examples:
# "0.0.1" - universe 1, all channels (1-512)
# "0.0.1:50" - universe 1, channel 50 only
# "0.0.1:50-" - universe 1, channels 50-512
# "0.0.1:50-100" - universe 1, channels 50-100
# 1 - universe 1, all channels
# "1:50-100" - universe 1, channels 50-100
# "artnet:0.0.1" - universe 1, all channels (1-512)
# "sacn:64:50" - universe 64, channel 50 only
# "artnet:0.0.1:50-" - universe 1, channels 50-512
# "sacn:1:50-100" - universe 1, channels 50-100
#
# To examples:
# "0.0.1" - universe 1, starting at channel 1
# "0.0.1:50" - universe 1, starting at channel 50
#
# Input protocol (optional, default "artnet"):
# from_proto = "artnet" - receive via ArtNet
# from_proto = "sacn" - receive via sACN/E1.31 (multicast)
#
# Output protocol (optional, default "artnet"):
# proto = "artnet" - output via ArtNet (broadcast or discovered nodes)
# proto = "sacn" - output via sACN/E1.31 (multicast)
# "artnet:0.0.1" - universe 1, starting at channel 1
# "sacn:1:50" - universe 1, starting at channel 50
# Remap entire universe
[[mapping]]
from = "0.0.0"
to = "0.0.5"
from = "artnet:0.0.0"
to = "artnet:0.0.5"
# Channel-level remap for fixture spillover
# Channels 450-512 from universe 0 -> channels 1-63 of universe 1
[[mapping]]
from = "0.0.0:450-512"
to = "0.0.1:1"
from = "artnet:0.0.0:450-512"
to = "artnet:0.0.1:1"
# Using plain universe numbers
[[mapping]]
from = 2
to = 10
from = "artnet:2"
to = "artnet:10"
# Multiple outputs from same source
[[mapping]]
from = "0.0.3"
to = "0.0.7"
from = "artnet:0.0.3"
to = "artnet:0.0.7"
[[mapping]]
from = "0.0.3"
to = "0.0.8"
from = "artnet:0.0.3"
to = "artnet:0.0.8"
# Output to sACN instead of ArtNet
[[mapping]]
from = "0.0.4"
to = 1
proto = "sacn"
from = "artnet:0.0.4"
to = "sacn:1"
# Convert sACN input to ArtNet output
[[mapping]]
from = 5
from_proto = "sacn"
to = "0.0.5"
from = "sacn:5"
to = "artnet:0.0.5"