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

fix: worker: Support IPv6 formatted API-keys #11141

Merged
merged 3 commits into from
Aug 16, 2023
Merged

fix: worker: Support IPv6 formatted API-keys #11141

merged 3 commits into from
Aug 16, 2023

Conversation

rjan90
Copy link
Contributor

@rjan90 rjan90 commented Aug 8, 2023

Related Issues

Closes: #11138

Proposed Changes

Add support for IPv6 formatted API keys in the lotus-worker.

Additional Info

Testing plan:

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

Add support for IPv6 in MINER_API_INFO env.
@rjan90 rjan90 requested a review from a team as a code owner August 8, 2023 10:25
@rjan90 rjan90 changed the title fix: worker: Support IPv6 fix: worker: Support IPv6 formatted API-keys Aug 8, 2023
@rjan90
Copy link
Contributor Author

rjan90 commented Aug 8, 2023

Testing plan:
Check that IPv4 formatted MINER_API_INFO works with the lotus-worker

Change listen address in lotus-miner config.toml to IPv4:

~/.lotusminer # cat config.toml
[API]
  # Binding address for the Lotus API
  #
  # type: string
  # env var: LOTUS_API_LISTENADDRESS
  #ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"

Generate IPv4 MINER_API_INFO env:

lotus-miner auth api-info --perm admin
MINER_API_INFO=eyJ.....hF6hrA:/ip4/127.0.0.1/tcp/2345/http

Export and run lotus-worker:

./lotus-worker run
2023-08-08T06:42:20.905-0400    INFO    main    lotus-worker/main.go:297        Starting lotus worker
----------
2023-08-08T06:42:44.508-0400    INFO    main    lotus-worker/main.go:532        Opening local storage; connecting to master
2023-08-08T06:42:44.514-0400    INFO    main    lotus-worker/main.go:607        Setting up control endpoint at 0.0.0.0:3456
2023-08-08T06:42:44.515-0400    INFO    main    lotus-worker/main.go:702        Making sure no local tasks are running
2023-08-08T06:42:44.540-0400    INFO    main    lotus-worker/main.go:725        Worker registered successfully, waiting for tasks

rjan90 added 2 commits August 8, 2023 12:49
Address the errcheck lint error by checking the return from conn.Close()
Add IPv6 check and format appropriately
@rjan90
Copy link
Contributor Author

rjan90 commented Aug 8, 2023

Testing plan:
Check that IPv6 formatted MINER_API_INFO works with the lotus-worker

Change listen address in lotus-miner config.toml to IPv6:

~/.lotusminer # cat config.toml
[API]
  # Binding address for the Lotus API
  #
  # type: string
  # env var: LOTUS_API_LISTENADDRESS
  ListenAddress = "/ip6/::1/tcp/2345/http"

Generate IPv6 MINER_API_INFO env:

lotus-miner auth api-info --perm admin
MINER_API_INFO=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJBbGxvdyI6WyJyZWFkIiwid3JpdGUiLCJzaWduIiwiYWRtaW4iXX0.tk5A_7_edZxWRkdiqyYk_pm9eGgiTb4jOZSahhF6hrA:/ip6/::1/tcp/2345/http

Export and run lotus-worker:

./lotus-worker run
2023-08-08T09:03:44.739-0400    INFO    main    lotus-worker/main.go:297        Starting lotus worker
2023-08-08T09:03:44.741-0400    INFO    main    lotus-worker/main.go:360        Remote version 1.23.3-rc2+butterflynet+git.9539f59e0.dirty+api1.5.0
-----------
2023-08-08T09:04:08.068-0400    INFO    main    lotus-worker/main.go:609        Setting up control endpoint at 0.0.0.0:3456
2023-08-08T09:04:08.069-0400    INFO    main    lotus-worker/main.go:704        Making sure no local tasks are running
2023-08-08T09:04:08.095-0400    INFO    main    lotus-worker/main.go:727        Worker registered successfully, waiting for tasks

@magik6k magik6k merged commit 22f4901 into master Aug 16, 2023
@magik6k magik6k deleted the fix/worker-IPv6 branch August 16, 2023 13:55
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.

lotus-worker does not support IPv6
2 participants