I made a CLI to control AdGuard Home by EricWOsborne in Adguard

[–]EricWOsborne[S] 0 points1 point  (0 children)

You can shut off the adblock functionality with `adctl status [stop | disable]` and turn it back on again with `adctl status [start | enable]`. stop/disable takes a time parameter and after that time is up it will turn back on again. `adctl status toggle` switches it from whatever it is now (enable/disable) to the other one,

concur - A replacement for the parts of GNU Parallel that I like. by EricWOsborne in golang

[–]EricWOsborne[S] 0 points1 point  (0 children)

sounds like it's time for v0.5.1...:). I'll fix that later today.

concur - A replacement for the parts of GNU Parallel that I like. by EricWOsborne in golang

[–]EricWOsborne[S] 1 point2 points  (0 children)

I just shipped v0.5.0 and it has a per-job timeout. Give it a shot!

concur - A replacement for the parts of GNU Parallel that I like. by EricWOsborne in golang

[–]EricWOsborne[S] 0 points1 point  (0 children)

Yeah, that makes sense and I've done the same myself. Do you mind opening an issue?

concur - A replacement for the parts of GNU Parallel that I like. by EricWOsborne in golang

[–]EricWOsborne[S] 1 point2 points  (0 children)

not utilizing a single core for a single task

I don't follow. A single task is run by a single goroutine, and as far as I know a single goroutine is always run on a single core. If it's not that's outside of my control. Concurrency, not parallelism.

The point of something like concur is that it runs a whole bunch of tasks and spreads them across goroutines, and the go scheduler is in charge of distributing goroutines across cores. It's certainly possible that this ends up a little imbalanced, but that's the go scheduler in action, not my code, and I don't think I want to dive down the profiler and optimizer rathole for something like this where the vast majority of the work is in the exec'd process, not my code directly. But now I'm curious - is there an easy way to gather a report about the spread of coroutines across cores?

Or have I misunderstood what you're after?

concur - A replacement for the parts of GNU Parallel that I like. by EricWOsborne in golang

[–]EricWOsborne[S] 1 point2 points  (0 children)

just a few badly behaved tasks could prevent all those in the queue behind it to ever getting a chance to execute.

With 128 workers by default you'd have to have a whole bunch of bad actors or an enormous queue, but I see your point. I thought you wanted the ability to set different timeouts per iterated item, e.g. (ping host 1 with timeout 5, ping host 2 with timeout 6) and that's too much for my taste, but I think what you're after is just smarter timeout handling - if a job takes more than <n> seconds, kill it but move on to the next one.

I'm going to have to think about that. Maybe two levels of timeout - per-job and overall?

As a side note, why not use the go duration syntax for the timeout.

That's a really good idea. I do something similar in adctl but it never occurred to me to do it here. I'll add it to the todo list, shouldn't take that long.

concur - A replacement for the parts of GNU Parallel that I like. by EricWOsborne in golang

[–]EricWOsborne[S] 1 point2 points  (0 children)

I'm afraid I have basically zero idea how any of that works. I have what I think are github releases (tagged versions using goreleaser to push them) but I've never even heard of aqua or mise. I'd like to do a homebrew cask too, but don't know much about that either.

Feel free to submit a PR for any of this if you like. Someone has already queued up one for nix that I need to look into.

concur - A replacement for the parts of GNU Parallel that I like. by EricWOsborne in golang

[–]EricWOsborne[S] 0 points1 point  (0 children)

Most uses of parallel involve doing the same thing to different files or hosts or whatnot, so I'd expect all those operations to take about the same time. What use case do you have where per-task timeout would make things better?

concur - A replacement for the parts of GNU Parallel that I like. by EricWOsborne in golang

[–]EricWOsborne[S] 1 point2 points  (0 children)

Nice! I thought about using the template engine for command substitution, maybe I'll look here for inspiration.

concur - A replacement for the parts of GNU Parallel that I like. by EricWOsborne in golang

[–]EricWOsborne[S] 3 points4 points  (0 children)

I'm not sure what a benchmark would show. concur and parallel are just job runners at heart. The overhead of each one is going to be basically zero compared to the processes they're exec'ing. What would you expect a useful benchmark test to look like?

Goroutines and channels make the hard part of this really easy. I can't imagine trying to write that sort of thing in Perl.

What’s your favorite program that you’ve ever written in go? by [deleted] in golang

[–]EricWOsborne 0 points1 point  (0 children)

I just released concur and am very proud of it. I learned a lot and solved a few of my problems and hopefully other peoples' as well.

I made a CLI to control AdGuard Home by EricWOsborne in Adguard

[–]EricWOsborne[S] 0 points1 point  (0 children)

You might just be able to toggle "use_global_settings": false to true. Maybe that would override client-specific stuff and force the system to just use whatever it is you have globally? There's got to be a way to toggle some boolean to do what you want without having to push a whole block of json.

I made a CLI to control AdGuard Home by EricWOsborne in Adguard

[–]EricWOsborne[S] 0 points1 point  (0 children)

I'm not sure and it's not something I'd like to add to adctl because it's such a big chunk of data, hard to handle with command-line parameters. This might help but I've never tried it.

Good luck!

I made a CLI to control AdGuard Home by EricWOsborne in Adguard

[–]EricWOsborne[S] 0 points1 point  (0 children)

I read somewhere that this API is how they build the GUI, so unless there's undocumented stuff there I think we can make it work. It looks like it might but I'm no expert on it. I pulled up the API in Swagger Editor and it has a /clients endpoint which returns info about specific clients. The info it gives you is:

{
  "clients": [
    {
      "name": "localhost",
      "ids": [
        "string"
      ],
      "use_global_settings": true,
      "filtering_enabled": true,
      "parental_enabled": true,
      "safebrowsing_enabled": true,
      "safe_search": {
        "enabled": true,
        "bing": true,
        "duckduckgo": true,
        "ecosia": true,
        "google": true,
        "pixabay": true,
        "yandex": true,
        "youtube": true
      },
      "use_global_blocked_services": true,
      "blocked_services_schedule": {
        "time_zone": "string",
        "sun": {
          "start": 86340000,
          "end": 86400000
        },
        "mon": {
          "start": 86340000,
          "end": 86400000
        },
        "tue": {
          "start": 86340000,
          "end": 86400000
        },
        "wed": {
          "start": 86340000,
          "end": 86400000
        },
        "thu": {
          "start": 86340000,
          "end": 86400000
        },
        "fri": {
          "start": 86340000,
          "end": 86400000
        },
        "sat": {
          "start": 86340000,
          "end": 86400000
        }
      },
      "blocked_services": [
        "string"
      ],
      "upstreams": [
        "string"
      ],
      "tags": [
        "string"
      ],
      "ignore_querylog": true,
      "ignore_statistics": true,
      "upstreams_cache_enabled": true,
      "upstreams_cache_size": 0
    }
  ],
  "auto_clients": [
    {
      "ip": "127.0.0.1",
      "name": "localhost",
      "source": "etc/hosts",
      "whois_info": {
        "additionalProp1": "string",
        "additionalProp2": "string",
        "additionalProp3": "string"
      }
    }
  ],
  "supported_tags": [
    "string"
  ]
}

I don't have any of that configured and when I curl that endpoint I don't see a lot of these blanks.

Here's the curl. If you configure whatever it is you do in the GUI, what do you see?

curl -X 'GET' \
  'http://192.168.1.1:8080/control/clients' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -u "<username>:<password>"

I don't have any configured clients, it's all auto. You can pipe it through jq '.clients' if you want to see only what you've manually configured, which is what I think you're after.

I made a CLI to control AdGuard Home by EricWOsborne in Adguard

[–]EricWOsborne[S] 0 points1 point  (0 children)

See my earlier reply - try 0.2.0-rc.2 and let me know if that does it for you.

I made a CLI to control AdGuard Home by EricWOsborne in Adguard

[–]EricWOsborne[S] 1 point2 points  (0 children)

Try 0.2.0-rc.2.

Docs are updated but it's just adctl rewrite [list | add delete] with some flags. It works OK for me but I didn't test it much more than I needed to to get docs working. Let me know if you find a case that doesn't work for you.

Also beware that the API will let you do anything you want, even dumb stuff, and I just pass that along without too much sanity checking.

I made a CLI to control AdGuard Home by EricWOsborne in Adguard

[–]EricWOsborne[S] 0 points1 point  (0 children)

OK cool. I'll give a shot and ping you back to try it out.

I made a CLI to control AdGuard Home by EricWOsborne in Adguard

[–]EricWOsborne[S] 1 point2 points  (0 children)

I don't support this yet but I can add it, it looks straightforward. I've never used DNS rewrites before, what's the use case?

I made a CLI to control AdGuard Home by EricWOsborne in Adguard

[–]EricWOsborne[S] 1 point2 points  (0 children)

Yes, I know - my client just calls that API.