Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dmsg utilities connect to dmsg direct with dmsghttp-config.json #260

Open
0pcom opened this issue Mar 26, 2024 · 1 comment
Open

dmsg utilities connect to dmsg direct with dmsghttp-config.json #260

0pcom opened this issue Mar 26, 2024 · 1 comment

Comments

@0pcom
Copy link
Collaborator

0pcom commented Mar 26, 2024

In reference to #1792

All dmsg utilities, but most urgently dmsgcurl, need to be able to use the dmsghttp-config.json to work as desired in China.

It should be fine to implement this in such a way that it relies on the dmsghttp-config in the skywire package as all the dmsg utilities are now included in the skywire binary release as subcommands of skywire dmsg

@0pcom 0pcom pinned this issue Mar 26, 2024
@0pcom
Copy link
Collaborator Author

0pcom commented Apr 7, 2024

This should be possible to do in a simple way ; merely by substituting the query to dmsg-discovery with a check of the dmsghttp-config or a specified file. Furthermore it should be readily possible to use a different dmsg discovery URL which is a locally running webserver that exposes the dmsghttp-config.json at, for instance: 127.0.0.1:8080/available_servers

update - did not work

$ ncat -kl 127.0.0.1 8082 --sh-exec 'read -r line; path=$(echo "$line" | awk "{ print \$2 }"); if [[ "$path" == "/dmsg-discovery/available_servers" ]]; then echo -ne "HTTP/1.1 200 OK\r\nContent-Type: application/json\r\n\r\n"; jq -c ".prod.dmsg_servers | map({version: \"0.0.1\", sequence: 0, timestamp: 0, static: .static, server: {address: .server.address, availableSessions: 0, serverType: \"official\"}, signature: \"\"})" /opt/skywire/dmsghttp-config.json; else echo -ne "HTTP/1.1 404 Not Found\r\n\r\n"; fi'
$ curl http://127.0.0.1:8082/dmsg-discovery/available_servers | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2069    0  2069    0     0   210k      0 --:--:-- --:--:-- --:--:--  224k
[
  {
    "version": "0.0.1",
    "sequence": 0,
    "timestamp": 0,
    "static": "02a2d4c346dabd165fd555dfdba4a7f4d18786fe7e055e562397cd5102bdd7f8dd",
    "server": {
      "address": "139.144.183.24:30082",
      "availableSessions": 0,
      "serverType": "official"
    },
    "signature": ""
  },
  {
    "version": "0.0.1",
    "sequence": 0,
    "timestamp": 0,
    "static": "03717576ada5b1744e395c66c2bb11cea73b0e23d0dcd54422139b1a7f12e962c4",
    "server": {
      "address": "139.144.183.24:30083",
      "availableSessions": 0,
      "serverType": "official"
    },
    "signature": ""
  },
  {
    "version": "0.0.1",
    "sequence": 0,
    "timestamp": 0,
    "static": "0228af3fd99c8d86a882495c8e0202bdd4da78c69e013065d8634286dd4a0ac098",
    "server": {
      "address": "192.46.229.112:30084",
      "availableSessions": 0,
      "serverType": "official"
    },
    "signature": ""
  },
  {
    "version": "0.0.1",
    "sequence": 0,
    "timestamp": 0,
    "static": "03d5b55d1133b26485c664cf8b95cff6746d1e321c34e48c9fed293eff0d6d49e5",
    "server": {
      "address": "139.177.189.68:30083",
      "availableSessions": 0,
      "serverType": "official"
    },
    "signature": ""
  },
  {
    "version": "0.0.1",
    "sequence": 0,
    "timestamp": 0,
    "static": "0281a102c82820e811368c8d028cf11b1a985043b726b1bcdb8fce89b27384b2cb",
    "server": {
      "address": "139.162.160.227:30086",
      "availableSessions": 0,
      "serverType": "official"
    },
    "signature": ""
  },
  {
    "version": "0.0.1",
    "sequence": 0,
    "timestamp": 0,
    "static": "02a49bc0aa1b5b78f638e9189be4ed095bac5d6839c828465a8350f80ac07629c0",
    "server": {
      "address": "139.144.183.24:30081",
      "availableSessions": 0,
      "serverType": "official"
    },
    "signature": ""
  },
  {
    "version": "0.0.1",
    "sequence": 0,
    "timestamp": 0,
    "static": "0326978f5a53aff537dbb47fed58b1f123af3b00132d365f1309a14db4168dcff7",
    "server": {
      "address": "70.121.23.42:9083",
      "availableSessions": 0,
      "serverType": "official"
    },
    "signature": ""
  },
  {
    "version": "0.0.1",
    "sequence": 0,
    "timestamp": 0,
    "static": "0371ab4bcff7b121f4b91f6856d6740c6f9dc1fe716977850aeb5d84378b300a13",
    "server": {
      "address": "139.162.160.227:30087",
      "availableSessions": 0,
      "serverType": "official"
    },
    "signature": ""
  },
  {
    "version": "0.0.1",
    "sequence": 0,
    "timestamp": 0,
    "static": "030c83534af1041aee60c2f124b682a9d60c6421876db7c67fc83a73c5effdbd96",
    "server": {
      "address": "188.121.99.59:8081",
      "availableSessions": 0,
      "serverType": "official"
    },
    "signature": ""
  }
]

$ skywire dmsg curl -l debug -c 127.0.0.1:8082 dmsg://$(skywire cli visor pk):80/health 
[2024-04-07T10:52:12.196059514-05:00] DEBUG disc.NewHTTP [dmsgcurl]: Created HTTP client. addr="127.0.0.1:8082"
[2024-04-07T10:52:12.196099827-05:00] DEBUG [dmsgcurl]: Connecting to dmsg network... dmsg_disc="127.0.0.1:8082" public_key="03b54827042241e681f52be2b44f67cef4a4fbcd02b5c76d3a0877293aa6078e1e"
[2024-04-07T10:52:12.196153976-05:00] DEBUG [dmsg_client]: Discovering dmsg servers...
[2024-04-07T10:52:13.196304152-05:00] WARN retrier [dmsg_client]: Retrying... current_backoff=1.3s error="parse "127.0.0.1:8082/dmsg-discovery/available_servers": first path segment in URL cannot contain colon"
[2024-04-07T10:52:14.496808174-05:00] WARN retrier [dmsg_client]: Retrying... current_backoff=1.69s error="parse "127.0.0.1:8082/dmsg-discovery/available_servers": first path segment in URL cannot contain colon"
[2024-04-07T10:52:16.187680397-05:00] WARN retrier [dmsg_client]: Retrying... current_backoff=2.197s error="parse "127.0.0.1:8082/dmsg-discovery/available_servers": first path segment in URL cannot contain colon"
[2024-04-07T10:52:18.386054676-05:00] WARN retrier [dmsg_client]: Retrying... current_backoff=2.8561s error="parse "127.0.0.1:8082/dmsg-discovery/available_servers": first path segment in URL cannot contain colon"
[2024-04-07T10:52:21.245070426-05:00] WARN retrier [dmsg_client]: Retrying... current_backoff=3.71293s error="parse "127.0.0.1:8082/dmsg-discovery/available_servers": first path segment in URL cannot contain colon"
[2024-04-07T10:52:24.960945879-05:00] WARN retrier [dmsg_client]: Retrying... current_backoff=4.826809s error="parse "127.0.0.1:8082/dmsg-discovery/available_servers": first path segment in URL cannot contain colon"
[2024-04-07T10:52:29.791962951-05:00] WARN retrier [dmsg_client]: Retrying... current_backoff=6.2748517s error="parse "127.0.0.1:8082/dmsg-discovery/available_servers": first path segment in URL cannot contain colon"
[2024-04-07T10:52:36.07239575-05:00] WARN retrier [dmsg_client]: Retrying... current_backoff=8.15730721s error="parse "127.0.0.1:8082/dmsg-discovery/available_servers": first path segment in URL cannot contain colon"
^C[2024-04-07T10:52:37.39505461-05:00] INFO [dmsgcurl]: Closing with received signal. signal=interrupt
[2024-04-07T10:52:37.395181853-05:00] DEBUG [dmsg_client]: All sessions closed.
[2024-04-07T10:52:37.395223873-05:00] DEBUG [dmsgcurl]: Disconnected from dmsg network. error="parse "127.0.0.1:8082/dmsg-discovery/entry/03b54827042241e681f52be2b44f67cef4a4fbcd02b5c76d3a0877293aa6078e1e": first path segment in URL cannot contain colon"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant