Skip to content

Allow configuration of port for tsnet to facilitate direct connections when run in containers #84

@chrishoage

Description

@chrishoage

I am having much difficulty making consistent direct connections to services hosted from a caddy-tailscale docker container which reside only on my tailnet.

Other containers which use tailscaled directly allow me to specify a port which I can expose and allow direct connections when running in userspace mode inside a docker container.

My proposal is allowing the configuration of the Port field in tsnet to allow for these udp ports to be exposed to the internet to facilitate direct connections to these tsnet nodes on the tailnet. Since the ports are otherwise randomized it doesn't seem feasible to know what ports to expose.

https://github.com/tailscale/tailscale/blob/ff095606ccff083160eb01a8a4cc062cacfe1a33/tsnet/tsnet.go#L119-L122

The simplest solution is to add an additional field for the <node_name> conflagration option

e.g.

{
  tailscale {
    my_node {
      port 41647
    }
  }
}

However, allowing for a range in the global config would make it much easier to expose the range via docker

{
  tailscale {
    port_range "41642-41649"
  }
}

If the range is exhausted while building the config struct this is an error.

I have done a decent amount of experimenting with my tailnet and my conclusion this is an issue unique to caddy-tailscale (or tsnet more specially) when run inside a docker container and not on the host directly. Running the container in "host" network mode is not an option as then I lose out on docker networking (e.g. a docker proxy network, etc)

If there is something I'm missing with ensuring direct connections to nodes hosted via caddy-tailscale please feel free to close this issue (and perhaps let me know what I am missing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions