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

Zerotier local url CLI, env setting #207

Merged
merged 5 commits into from
Mar 23, 2023
Merged

Conversation

erikh
Copy link
Contributor

@erikh erikh commented Mar 6, 2023

Closes #196

Be aware this is rebased against #206. Please merge that first to avoid trouble.

This implements a CLI option and environment variable for specifying the local zerotier url. Please note my aptitude for programming is significantly ... rusty (ha! I PUNNED) and that it's probably not the optimal patch. Carrying the launcher struct is probably a better long-term choice.

There are a lot of clippy warnings in the code now. I might take some time and beat some of these back, but there's also a good chance I won't expend the energy, so be aware they are there.

I hope this helps you folks on your journey.

…nvironment.

Signed-off-by: Erik Hollensbe <git@hollensbe.org>
@laduke
Copy link
Contributor

laduke commented Mar 22, 2023

oops. Merging #208 broke this. I'm not sure why but git is doing a bad job at rebasing this for me. Will figure it out.

erikh and others added 3 commits March 22, 2023 13:45
Signed-off-by: Erik Hollensbe <git@hollensbe.org>
…ching on an Option<>

Simply a better patch!

Signed-off-by: Erik Hollensbe <git@hollensbe.org>
@laduke
Copy link
Contributor

laduke commented Mar 22, 2023

I have a fixed up version here https://github.com/laduke/zeronsd/tree/tl-zerotier-url
integration tests pass and a quick check of cargo run seemed ok.
It wouldn't let me force push over this pr's branch.

@erikh
Copy link
Contributor Author

erikh commented Mar 22, 2023 via email

Signed-off-by: Erik Hollensbe <git@hollensbe.org>
@erikh
Copy link
Contributor Author

erikh commented Mar 22, 2023 via email

@laduke laduke merged commit c063819 into zerotier:main Mar 23, 2023
@laduke
Copy link
Contributor

laduke commented Mar 23, 2023

Awesome. Thanks! I tested it all locally.

@adobito
Copy link

adobito commented Jan 17, 2024

EDIT: Looks like the container I pulled from docker hub is super old and doesn't have this.

EDIT 2: @erikh Is it trivial for you to push a new image? I don't have my env set up to build this and build my own image, and would prefer to avoid it as I just want to give zeronsd a try more than anything.

I'm trying to use this feature but it doesn't appear to be a valid parameter for me.

root@e534403a6208:/# zeronsd start --help
zeronsd-start 
Start the nameserver

USAGE:
    zeronsd start [OPTIONS] <NETWORK_ID>

ARGS:
    <NETWORK_ID>    Network ID to query

OPTIONS:
    -c, --config <PATH>                Configuration file containing these arguments (overrides most
                                       CLI options)
        --chain-cert <PATH>            
        --config-type <CONFIG_TYPE>    Configuration file format [yaml, json, toml] [default: yaml]
    -d, --domain <DOMAIN>              TLD to use for hostnames
    -f, --file <PATH>                  An additional list of hosts in /etc/hosts format
    -h, --help                         Print help information
    -l, --log-level <LEVEL>            Log Level to print [off, trace, debug, error, warn, info]
    -s, --secret <PATH>                Path to authtoken.secret (usually detected)
    -t, --token <PATH>                 Path to a file containing the ZeroTier Central token
        --tls-cert <PATH>              
        --tls-key <PATH>               
    -v                                 Verbose logging (repeat -v for more verbosity)
    -w, --wildcard                     Wildcard all names in Central to point at the respective
                                       member's IP address(es)

when I check the version, I get

root@e534403a6208:~# zeronsd -V
zeronsd 0.5.2

This version appears to be deployed after this change made it in, so I think it should be there. is there something I'm doing wrong?

@erikh
Copy link
Contributor Author

erikh commented Jan 17, 2024 via email

@adobito
Copy link

adobito commented Jan 17, 2024

I don't think a release has been cut with it in there yet.

Oh that makes sense. No wonder when I checked version I thought I was at latest.

I'll see if I can a get a docker image built with latest so I can take it for a spin. I should also have a docker compose file that should be able to run zeronsd with its own copy of zerotier-cli, but sadly I'm sure I can't get it to work until I can pass the local url as an env var.

@bruteForce93
Copy link

bruteForce93 commented Apr 14, 2024

I have a fixed up version here https://github.com/laduke/zeronsd/tree/tl-zerotier-url integration tests pass and a quick check of cargo run seemed ok. It wouldn't let me force push over this pr's branch.

I have tried compiling this but bumped into some errors...

error[E0308]: ? operator has incompatible types
--> src/utils.rs:69:9
|
69 | / reqwest::Client::builder()
70 | | .user_agent(version())
71 | | .https_only(true)
72 | | .default_headers(headers)
73 | | .build()?,
| |_____________________^ expected reqwest::async_impl::client::Client, found reqwest::Client
|
= note: ? operator cannot convert from reqwest::Client to reqwest::async_impl::client::Client
= note: reqwest::Client and reqwest::async_impl::client::Client have similar names, but are actually distinct types
note: reqwest::Client is defined in crate reqwest
--> /home/emini/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.12.3/src/async_impl/client.rs:71:1
|
71 | pub struct Client {
| ^^^^^^^^^^^^^^^^^
note: reqwest::async_impl::client::Client is defined in crate reqwest
--> /home/emini/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.11.27/src/async_impl/client.rs:69:1
|
69 | pub struct Client {
| ^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate reqwest are being used?

error[E0308]: ? operator has incompatible types
--> src/utils.rs:194:9
|
194 | / reqwest::Client::builder()
195 | | .user_agent(version())
196 | | .default_headers(headers)
197 | | .build()?,
| |_____________________^ expected reqwest::async_impl::client::Client, found reqwest::Client
|
= note: ? operator cannot convert from reqwest::Client to reqwest::async_impl::client::Client
= note: reqwest::Client and reqwest::async_impl::client::Client have similar names, but are actually distinct types
note: reqwest::Client is defined in crate reqwest
--> /home/emini/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.12.3/src/async_impl/client.rs:71:1
|
71 | pub struct Client {
| ^^^^^^^^^^^^^^^^^
note: reqwest::async_impl::client::Client is defined in crate reqwest
--> /home/emini/.cargo/registry/src/index.crates.io-6f17d22bba15001f/reqwest-0.11.27/src/async_impl/client.rs:69:1
|
69 | pub struct Client {
| ^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate reqwest are being used?

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

Successfully merging this pull request may close these issues.

Cannot find local zerotier-one server that doesn't listen on port 9993
4 participants