Tereius / noxon-server

📻 A simple server getting legacy iRadio devices up and running again
6 stars 0 forks source link

Can't get it to work #2

Closed rucksman closed 7 months ago

rucksman commented 7 months ago

Hi, I was very happy to find a way to use my iRadio 300 again with your project. Unfortunately I can't get it to work.

Tried it with the Windows binary for a first quick and dirty test, but my config.toml does not work. For example I always get this error message: Config file could not be parsed properlyerrorsome fields could not be decodedfields[dns.domains] I tried many different styles for the domain array, but nothing worked: single quotes, double quotes, comma, semicolons, ... Double quotes and comma should work (https://github.com/BurntSushi/toml), but they do not.

Then I tried docker. Did not work either. I have to say that I operate my own DNS resolver (as a Docker container), so I did set the env variable DNS_ENABLED to false. Of course I made entries for noxonserver and vtuner in my resolver. I did reset my iRadio 300 to factory settings. Then I restartet it und tried "Internetradio". It loads and loads end never comes to an end. I checked what it is doing with wireshark, and this is the result: image So the iRadio requests the loginXML.asp, and the answer is always 301 (Location: https://legacy.noxonserver.eu/setupapp/fs/asp/BrowseXML/loginXML.asp?token=0).

Any idea what happens here?

Another question: How can I get to the status.html? With Windows I tried localhost and 127.0.0.1 as well as / and /status.html. Result is always 404. In Linux I created a FQDN in my reverse proxy, but the result is also always 404 ...

Help would be very much appreciated. Thanks!

rucksman commented 7 months ago

Well, identified the first problem: There is an error in den README. The parameter must not be dns.domains but dns.records: https://github.com/Tereius/noxon-server/blob/5135ffcd2fa03acf18cbbe98588180742aabf3ab/internal/config.go#L15 But this is more a cosmetic issue in my case, I still can't get it to run ...

Tereius commented 7 months ago

Please create a confg.toml file with this content:

dns.enabled = true
dns.hostIp = "<hostIp>"

Replace the <hostIp> with your host ip.

Also create a stations.json file with this content:

[
  {
    "stationName": "HR info",
    "stationDescription": "HR info",
    "stationUrl": "https://dispatcher.rndfnk.com/hr/hrinfo/live/mp3/high"
  },
  {
    "stationName": "HR 2",
    "stationDescription": "HR 2",
    "stationUrl": "https://dispatcher.rndfnk.com/hr/hr2/live/mp3/high"
  },
  {
    "stationName": "DLF",
    "stationDescription": "Deutschlandfunk",
    "stationUrl": "https://st01.sslstream.dlf.de/dlf/01/128/mp3/stream.mp3?aggregator=web"
  },
  {
    "stationName": "BBC World Service",
    "stationDescription": "BBC World Service",
    "stationUrl": "http://stream.live.vc.bbcmedia.co.uk/bbc_world_service"
  },
  {
    "stationName": "SWR Aktuell",
    "stationDescription": "SWR Aktuell",
    "stationUrl": "https://dispatcher.rndfnk.com/swr/swraktuell/live/mp3/128/stream.mp3"
  }
]

Finally create an empty presets.json file.

Now run the noxon-server binary from the same directory where those three files are located (run it via cmd with admin rights). Don't provide any environment variables. Configure your iRadio device as described here.

Does it work now? If not can you please provide the logs and a wireshark dump.

The status page can be found here http://localhost/status

rucksman commented 7 months ago

Thanks for your answer. I tried as you described (which I did also already before), no luck. This is my last try:

rucksman commented 7 months ago

Made minimal progress. Skipped the Windows binary and switched to the Linux binary on my old server. Activated DNS in the config file. Resetted the radio again. Finally after some waiting on "Lädt ..." the station list shows up. But no matter which station I choose, the radio says "Verbindet ..." for something like 30 seconds, than "Lädt" for the fraction of a second and then "Neuverbndung". Thats it, nothing happens anymore.

Wiresharks shows a GET request from the radio to the server for /playback?mac=9e7806afbf99b44d6b142c111d013a3b&stationId=NA== HTTP/1.0, the server answers 502 Bad Gateway.

The logs show:

time="2024-03-27T16:34:50+01:00" level=debug msg="Playback request for stationId 0" device="{<some id>    }"
time="2024-03-27T16:34:50+01:00" level=info msg="Starting proxy for target url: https://dispatcher.rndfnk.com/hr/hrinfo/live/mp3/high" device="{<some id>    }"
time="2024-03-27T16:34:50+01:00" level=error msg="Proxy error: dial tcp: lookup dispatcher.rndfnk.com on 127.0.0.53:53: server misbehaving" device="{<some id>    }"
time="2024-03-27T16:34:50+01:00" level=error msg="<IP radio> - <servername> [27/Mar/2024:16:34:50 +0100] \"GET /playback\" 502 0 \"\" \"NSPlayer/8.0.0.3801\" (3ms)" clientIP=<IP radio> dataLength=0 hostname=<servername> latency=3 method=GET path=/playback referer= statusCode=502 userAgent=NSPlayer/8.0.0.3801
Tereius commented 7 months ago

Without a full Wireshark dump, I can only guess what is happening: The reverse proxy wants to connect to the streaming server of the radio station located at the domain dispatcher.rndfnk.com (second line of the log). So far so good.

So the next thing to do is to resolve the domain dispatcher.rndfnk.com to an ip address. But there seems to be an error (third line of the log). The domain dispatcher.rndfnk.com can not be resolved. Can you check on your Linux server that the domain can actually be resolved: getent hosts dispatcher.rndfnk.com should return a public ipv4 or ipv6.

Tereius commented 7 months ago

I just ran noxon-server v1.1.1 binary on my Linux machine and simulated the playback request of the iRadio device with curl (I don't have the device at hand right now): curl -L -v 'localhost/playback?mac=9e7806afbf99b44d6b142c111d013a3b&stationId=MA=='

And the noxon-server logs the expected responses which look like this:


time="2024-03-27T19:43:31+01:00" level=info msg="Starting proxy for target url: https://dispatcher.rndfnk.com/hr/hrinfo/live/mp3/high" device="{9e7806afbf99b44d6b142c111d013a3b    }"
time="2024-03-27T19:43:31+01:00" level=info msg="Got redirect request" device="{9e7806afbf99b44d6b142c111d013a3b    }"
time="2024-03-27T19:43:31+01:00" level=info msg="Forwarding redirect to new location https://d121.rndfnk.com/ard/hr/hrinfo/live/mp3/128/stream.mp3?cid=01FBPYRECZW4SNS714QRSDEXBQ&sid=2eHcb2BHSIwAWi6RrK9Cps98t8y&token=ZT4zZYnRI3KTRCCCL-mc7cvUeN2EUMh8Zmcv85XA8IA&tvf=c2wnevTGwBdkMTIxLnJuZGZuay5jb20" device="{9e7806afbf99b44d6b142c111d013a3b    }"
time="2024-03-27T19:43:31+01:00" level=info msg="::1 - bjoern-pc [27/Mar/2024:19:43:31 +0100] \"GET /playback\" 302 104 \"\" \"curl/8.6.0\" (116ms)" clientIP="::1" dataLength=104 hostname=bjoern-pc latency=116 method=GET path=/playback referer= statusCode=302 userAgent=curl/8.6.0
time="2024-03-27T19:43:31+01:00" level=debug msg="Playback request for stationId 0" device="{9e7806afbf99b44d6b142c111d013a3b    }"
time="2024-03-27T19:43:31+01:00" level=info msg="Starting proxy for target url: https://d121.rndfnk.com/ard/hr/hrinfo/live/mp3/128/stream.mp3?cid=01FBPYRECZW4SNS714QRSDEXBQ&sid=2eHcb2BHSIwAWi6RrK9Cps98t8y&token=ZT4zZYnRI3KTRCCCL-mc7cvUeN2EUMh8Zmcv85XA8IA&tvf=c2wnevTGwBdkMTIxLnJuZGZuay5jb20" device="{9e7806afbf99b44d6b142c111d013a3b    }"
time="2024-03-27T19:43:31+01:00" level=info msg="::1 - bjoern-pc [27/Mar/2024:19:43:31 +0100] \"GET /playback\" 200 20474 \"\" \"curl/8.6.0\" (107ms)" clientIP="::1" dataLength=20474 hostname=bjoern-pc latency=107 method=GET path=/playback referer= statusCode=200 userAgent=curl/8.6.0```
rucksman commented 7 months ago

Made some further progress. First I tried the Linux binary on my production server, but it did not start as it could not bind port 80 (there are already some Docker containers running behind a reverse proxy on this port). So out of despair I tried the ARM binary on a Raspberry Pi. Configuration is as follows: in the config.toml I disabled DNS and instead made an entry in my unbound.conf on my production server for legacy.noxonserver.eu pointing to the Raspberry Pi. Then I configured the radio DNS for the IP of the production server. FInally this worked! BUT: the Raspberry Pi cannot be a used as a permanent host for the noxon-server out of many reasons. So my goal would be to run it in a Docker container on my production server. I already tried some configurations, but nothing worked. So out of my working conf on the Rsapberry Pi: Would would be a working configuration on my production server? I have a reverse proxy (Traefik) running on the server as well as an Unbound resolver, both of course in Docker containers.

rucksman commented 7 months ago

Finally:

version: "3"

services:
  noxon-server:
    image: noxon-server
    container_name: noxon-server
    build:
      context: ../
      dockerfile: ./docker/Dockerfile
    ports:
      - 80/tcp
    environment:
      - "DNS_ENABLED=false"
    volumes:
      - type: bind
        source: stations.json
        target: /noxon/stations.json
      - type: bind
        source: presets.json
        target: /noxon/presets.json
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.noxon-server.entrypoints=http"
      - "traefik.http.routers.noxon-server.priority=1000"
      - "traefik.http.routers.noxon-server.rule=Host(`legacy.noxonserver.eu`)"
      - "traefik.docker.network=frontend"
      - "traefik.http.services.noxon-server.loadbalancer.server.port=80"
      - "traefik.http.services.noxon-server.loadbalancer.server.scheme=http"
      - "traefik.http.routers.noxon-server.service=noxon-server"
    networks:
      - frontend

networks:
  frontend:
    external: true

Entry in unbound.conf for legacy.noxonserver.eu pointing to host IP, iRadio DNS points to host IP.