diff options
author | xegineering <me@xegineering.eu> | 2024-11-27 21:29:39 +0100 |
---|---|---|
committer | xegineering <me@xegineering.eu> | 2024-11-27 21:38:16 +0100 |
commit | 6b7da29eea100b92659a3f1f5df6958ebad544c8 (patch) | |
tree | 11684e238ee86109423b564a91f5804bc3bf499e /soundbox/network.go | |
parent | d4cf5ed8e38d1e5d0b8110e8959e002c216f073f (diff) | |
download | soundbox-go-6b7da29eea100b92659a3f1f5df6958ebad544c8.tar soundbox-go-6b7da29eea100b92659a3f1f5df6958ebad544c8.tar.zst soundbox-go-6b7da29eea100b92659a3f1f5df6958ebad544c8.zip |
Introduce io.Reader-based streamContext()
This prepares the switch to adding more sources than web URLs.
Everything providing an io.Reader can then simply use this internal
function in the background to avoid code duplication.
Diffstat (limited to 'soundbox/network.go')
-rw-r--r-- | soundbox/network.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/soundbox/network.go b/soundbox/network.go index 6e7acea..11d9362 100644 --- a/soundbox/network.go +++ b/soundbox/network.go @@ -7,6 +7,10 @@ import ( "time" ) +// streamingPort is the default network port a soundbox is listening to for +// incoming audio stream data. +const streamingPort = 5316 + const dialTimeoutSeconds = 3 // toLinkLocal converts a MAC address to the corresponding IPv6 link-local @@ -34,7 +38,7 @@ func dialContext(ctx context.Context, ha net.HardwareAddr) (net.Conn, error) { } c := make(chan net.Conn) - dialContext, cancel := context.WithTimeout(ctx, dialTimeoutSeconds * time.Second) + dialContext, cancel := context.WithTimeout(ctx, dialTimeoutSeconds*time.Second) defer cancel() for _, iface := range ifaces { go func() { |