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

Make UDP port configurable #390

Merged
merged 2 commits into from
Sep 11, 2024
Merged

Make UDP port configurable #390

merged 2 commits into from
Sep 11, 2024

Conversation

lmagyar
Copy link
Contributor

@lmagyar lmagyar commented Jul 18, 2024

Proposed Changes

Without this option TS is not always able to establish peer-to-peer connections.

See #388 for more details.

Related Issues

fixes #388 #372

Summary by CodeRabbit

  • New Features

    • Introduced the udp_port option to specify the UDP port for WireGuard and peer-to-peer traffic.
    • Added configuration for allowing UDP traffic on port 41641.
  • Documentation

    • Updated documentation to include details on the use of UDP port 41641 for enhancing peer-to-peer connectivity, especially in CGNAT scenarios.
    • Provided guidance on testing connections using the tailscale ping <hostname-or-ip> command.

Copy link

coderabbitai bot commented Jul 18, 2024

Walkthrough

The recent update introduces a configuration option udp_port for Tailscale, enabling users to specify the UDP port for WireGuard and peer-to-peer traffic. This enhancement allows for consistent port settings across container restarts, simplifying port forwarding. Documentation and configuration files have been updated to reflect this addition and offer clear usage instructions.

Changes

Files Change Summaries
tailscale/DOCS.md Added documentation for the new udp_port option and related usage details.
tailscale/config.yaml Introduced a new ports field with udp_port for specifying UDP mappings in the configuration schema.
tailscale/rootfs/.../s6-rc.d/tailscaled/run Implemented logic to utilize the configured udp_port in the service's operation.
tailscale/translations/en.yaml Updated to include the new udp_port configuration option in the network section.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ConfigFile
    participant TailscaleService
    participant NetworkConfig

    User->>ConfigFile: Adds udp_port to configuration
    ConfigFile->>TailscaleService: Passes udp_port setting
    TailscaleService->>NetworkConfig: Applies udp_port for WireGuard and peer-to-peer traffic
    NetworkConfig->>TailscaleService: Confirms configuration
    TailscaleService->>User: Service starts with specified udp_port
Loading

Assessment against linked issues

Objective (Issue #388) Addressed Explanation
Add a configuration option to set a specific port for endpoint
Ensure the specified port remains consistent across reboots

Poem

In the land of Tailscale, ports were astray,
Until a bright rabbit hopped by one fine day.
"Set your UDP port," it cheerfully said,
"And your connections will fly, no more dread."
Now the paths are clear, thanks to this tweak,
Port forwarding's a breeze, no more havoc to wreak.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between df0f165 and 33fc2c0.

Files selected for processing (4)
  • tailscale/DOCS.md (2 hunks)
  • tailscale/config.yaml (1 hunks)
  • tailscale/rootfs/etc/s6-overlay/s6-rc.d/tailscaled/run (1 hunks)
  • tailscale/translations/en.yaml (1 hunks)
Additional comments not posted (5)
tailscale/config.yaml (1)

45-45: Addition of udp_port field looks good.

The udp_port field has been added correctly to the schema section, following the existing pattern and structure.

tailscale/rootfs/etc/s6-overlay/s6-rc.d/tailscaled/run (1)

19-23: Logic to use configured UDP port looks good.

The script correctly checks for the udp_port configuration and adds it to the options if specified.

tailscale/translations/en.yaml (1)

93-97: Addition of udp_port translation strings looks good.

The translation strings for the udp_port configuration option have been added correctly, following the existing pattern and structure.

tailscale/DOCS.md (2)

83-83: Addition of udp_port option in the configuration example looks good.

The udp_port option has been added correctly to the configuration example, following the existing format.


315-324: Documentation for udp_port option looks good.

The documentation provides a clear explanation of the udp_port option and its usage, following the existing format.

tailscale/DOCS.md Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 33fc2c0 and b14614f.

Files selected for processing (4)
  • tailscale/DOCS.md (1 hunks)
  • tailscale/config.yaml (1 hunks)
  • tailscale/rootfs/etc/s6-overlay/s6-rc.d/tailscaled/run (2 hunks)
  • tailscale/translations/en.yaml (1 hunks)
Files skipped from review as they are similar to previous changes (3)
  • tailscale/DOCS.md
  • tailscale/config.yaml
  • tailscale/translations/en.yaml
Additional comments not posted (3)
tailscale/rootfs/etc/s6-overlay/s6-rc.d/tailscaled/run (3)

8-8: LGTM! Variable declaration is correct.

The declaration of the udp_port variable is straightforward and follows the existing pattern.


20-24: LGTM! Logic to retrieve and use the configured UDP port is correct.

The logic to retrieve the UDP port from the addon configuration and add it to the options array is clear and correctly implemented.


Line range hint 8-24:
LGTM! Changes are well-integrated.

The changes are seamlessly integrated within the existing script structure, maintaining readability and functionality.

Copy link

There hasn't been any activity on this pull request recently. This pull request has been automatically marked as stale because of that and will be closed if no further activity occurs within 7 days. Thank you for your contributions.

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Aug 19, 2024
@lmagyar
Copy link
Contributor Author

lmagyar commented Aug 19, 2024

Not stale, waiting for decision whether it should be a plain config option or a network port.

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Aug 20, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b14614f and 6a904dc.

Files selected for processing (4)
  • tailscale/DOCS.md (1 hunks)
  • tailscale/config.yaml (1 hunks)
  • tailscale/rootfs/etc/s6-overlay/s6-rc.d/tailscaled/run (2 hunks)
  • tailscale/translations/en.yaml (1 hunks)
Additional comments not posted (4)
tailscale/config.yaml (1)

28-29: LGTM! Port configuration added successfully.

The addition of the ports entry for UDP traffic on port 41641 aligns with the PR objectives and enhances the configuration.

tailscale/rootfs/etc/s6-overlay/s6-rc.d/tailscaled/run (1)

Line range hint 8-24: LGTM! UDP port configuration logic added successfully.

The addition of the udp_port variable and the logic to configure Tailscale's options with a user-defined UDP port enhances the flexibility of the startup script.

tailscale/translations/en.yaml (1)

101-104: LGTM! New network configuration option added.

The addition of the UDP port configuration under the network section provides users with more control over their network setup.

tailscale/DOCS.md (1)

336-347: Documentation update looks good!

The new section provides clear and concise information about the UDP port configuration, aligning with the PR objectives and linked issues.

@frenck frenck added the new-feature New features or options. label Sep 11, 2024
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks, @lmagyar 👍

../Frenck

@frenck frenck merged commit 343419d into hassio-addons:main Sep 11, 2024
11 of 12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Sep 13, 2024
@lmagyar lmagyar deleted the pr-udp-port branch October 14, 2024 09:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-feature New features or options.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ablity to specify endpoint port for easy port forwarding
2 participants