tsujamin / hass-addons

108 stars 35 forks source link

Funnel Support #56

Closed stroodle96 closed 1 year ago

stroodle96 commented 1 year ago

Any plans to add support for the new funnel feature that is in alpha?

Additional context https://tailscale.com/kb/1223/tailscale-funnel/

tsujamin commented 1 year ago

No plans my end currently, I'm not sure what the best way to expose and configure it would be. Not against merging a PR for it.

Also I wonder if the easiest way in the interim would be to enable SSH support in your addon install then use that to start/stop funnel as you need?

I'll mull it over, just not many spare cycles for dev at the moment 🙂

lmagyar commented 1 year ago

My 2 cents...

I've stolen the idea from: https://github.com/elcajon-tech/addon-tailscale

And modified the official add-on, the core logic is below, it runs after the local https proxy is up (full file):

bashio::log.info "Enabling Tailscale Funnel..."

# Check if funnel is available
if ! /opt/tailscale serve funnel off; then
  bashio::log.info "Funnel is not available, is Tailscale's Funnel feature enabled?"
  bashio::log.info "If you wan't to access this device through Tailscale's Funnel,"
  bashio::log.info "please change configuration and restart this add-on."
  bashio::log.info "See the 'Required Tailscale configuration' chapter in the add-on's Documentation."
  bashio::exit.ok
fi

# Set up funnel
if ! /opt/tailscale serve funnel on; then
  bashio::log.error "Unable to configure Tailscale Funnel"
  bashio::exit.nok
fi
bashio::log.info "Tailscale Funnel is enabled:"
bashio::log.info "  Your Homeassistant instance is publicly available on the internet at"
bashio::log.info "  https://${domain}"
tsujamin commented 1 year ago

Huh that's pretty neat. I'm probably too time poor atm to add it to this add-on but if you feel like making a PR I'd merge it in, no pressure though if you've already found a solution that works for you!