How to build custom tailscale android client? #43

Closed
opened 2025-12-29 01:20:59 +01:00 by adam · 4 comments
Owner

Originally created by @khartahk on GitHub (Oct 10, 2021).

Hey,
I'm trying to set up headscale to replace the tailscale.com server. I've found the issue juanfont/headscale#58 were it says I need to change the ipn.Prefs and then compile tailscale android client with the change but I'm having trouble understanding how/where I need to change the domain to which the client connects.

Any help would be appreciated.

Also using make dockershell does not work because once built and inside the container running make tailscale-debug.apk fails with:

mkdir -p android/libs
go run gioui.org/cmd/gogio -buildmode archive -target android -appid com.tailscale.ipn -o android/libs/ipn.aar github.com/tailscale/tailscale-android/cmd/tailscale
# runtime/internal/sys
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# internal/unsafeheader
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# internal/race
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# unicode
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# unicode/utf8
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# sync/atomic
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# runtime/internal/atomic
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# internal/cpu
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# math/bits
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# golang.org/x/image/math/f64
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# golang.org/x/text/encoding/internal/identifier
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# image/color
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# golang.org/x/text/internal/utf8internal
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# unicode/utf16
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# internal/goversion
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# encoding
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# golang.org/x/mod/semver
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
# golang.org/x/xerrors/internal
compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128"
make: *** [Makefile:54: tailscale-debug.apk] Error 2

If someone can help me with this I'd appreciate it.

Originally created by @khartahk on GitHub (Oct 10, 2021). Hey, I'm trying to set up headscale to replace the tailscale.com server. I've found the issue juanfont/headscale#58 were it says I need to change the ipn.Prefs and then compile tailscale android client with the change but I'm having trouble understanding how/where I need to change the domain to which the client connects. Any help would be appreciated. Also using `make dockershell` does not work because once built and inside the container running `make tailscale-debug.apk` fails with: ``` mkdir -p android/libs go run gioui.org/cmd/gogio -buildmode archive -target android -appid com.tailscale.ipn -o android/libs/ipn.aar github.com/tailscale/tailscale-android/cmd/tailscale # runtime/internal/sys compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # internal/unsafeheader compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # internal/race compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # unicode compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # unicode/utf8 compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # sync/atomic compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # runtime/internal/atomic compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # internal/cpu compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # math/bits compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # golang.org/x/image/math/f64 compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # golang.org/x/text/encoding/internal/identifier compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # image/color compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # golang.org/x/text/internal/utf8internal compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # unicode/utf16 compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # internal/goversion compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # encoding compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # golang.org/x/mod/semver compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" # golang.org/x/xerrors/internal compile: version "go1.16.5" does not match go tool version "go1.17.1-ts097d128" make: *** [Makefile:54: tailscale-debug.apk] Error 2 ``` If someone can help me with this I'd appreciate it.
adam closed this issue 2025-12-29 01:20:59 +01:00
Author
Owner

@kradalby commented on GitHub (Oct 11, 2021):

Hi @khartahk we can't help you build the tailscale client, that's out of our ability to support.

The issue tracker is for tracking headscale issues.

@kradalby commented on GitHub (Oct 11, 2021): Hi @khartahk we can't help you build the tailscale client, that's out of our ability to support. The issue tracker is for tracking headscale issues.
Author
Owner

@a1ad commented on GitHub (Oct 28, 2021):

Just for reference, the things I did to make it work:

git clone https://github.com/tailscale/tailscale-android.git
nano tailscale-android/cmd/tailscale/backend.go

change:

func (b *backend) Start(notify func(n ipn.Notify)) error {
	b.backend.SetNotifyCallback(notify)
	return b.backend.Start(ipn.Options{
		StateKey: "ipn-android",
	})
}

to:

func (b *backend) Start(notify func(n ipn.Notify)) error {
    b.backend.SetNotifyCallback(notify)
    prefs := ipn.NewPrefs()
    prefs.ControlURL = "https://myheadscale.example.org"
    opts := ipn.Options{
    StateKey: "ipn-android",
        UpdatePrefs: prefs,
    }
    return b.backend.Start(opts)
}

adjust the Dockerfile:
ARG GO_VERSION=1.17.1
and comment out or change the sha256sum to the 1.17.1 one.
save + exit

make dockershell

in the new docker:

make tailscale-debug.apk

you get the error: compile: version "go1.17.1" does not match go tool version "go1.17.1-ts097d128"
manual run these commands:

go run gioui.org/cmd/gogio -buildmode archive -target android -appid com.tailscale.ipn -o android/libs/ipn.aar github.com/tailscale/tailscale-android/cmd/tailscale

(cd android && ./gradlew assemblePlayDebug)
mv android/build/outputs/apk/play/debug/android-play-debug.apk tailscale-debug.apk

Copy the the apk to your mobile
Sign in with "other" and register the device

Done

@a1ad commented on GitHub (Oct 28, 2021): Just for reference, the things I did to make it work: git clone https://github.com/tailscale/tailscale-android.git nano tailscale-android/cmd/tailscale/backend.go change: ``` func (b *backend) Start(notify func(n ipn.Notify)) error { b.backend.SetNotifyCallback(notify) return b.backend.Start(ipn.Options{ StateKey: "ipn-android", }) } ``` to: ``` func (b *backend) Start(notify func(n ipn.Notify)) error { b.backend.SetNotifyCallback(notify) prefs := ipn.NewPrefs() prefs.ControlURL = "https://myheadscale.example.org" opts := ipn.Options{ StateKey: "ipn-android", UpdatePrefs: prefs, } return b.backend.Start(opts) } ``` adjust the Dockerfile: ARG GO_VERSION=1.17.1 and comment out or change the sha256sum to the 1.17.1 one. save + exit make dockershell in the new docker: make tailscale-debug.apk you get the error: compile: version "go1.17.1" does not match go tool version "go1.17.1-ts097d128" manual run these commands: ``` go run gioui.org/cmd/gogio -buildmode archive -target android -appid com.tailscale.ipn -o android/libs/ipn.aar github.com/tailscale/tailscale-android/cmd/tailscale (cd android && ./gradlew assemblePlayDebug) mv android/build/outputs/apk/play/debug/android-play-debug.apk tailscale-debug.apk ``` Copy the the apk to your mobile Sign in with "other" and register the device Done
Author
Owner

@happytrudy commented on GitHub (Jan 12, 2022):

可以做个linux的客户端的 项目吗

@happytrudy commented on GitHub (Jan 12, 2022): 可以做个linux的客户端的 项目吗
Author
Owner

@12nick12 commented on GitHub (Mar 19, 2022):

This worked for me, thank you so much.

@12nick12 commented on GitHub (Mar 19, 2022): This worked for me, thank you so much.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#43