ipn: add Hostname override to Prefs

Overriding the hostname is required for Android, where os.Hostname
is often just "localhost".

Updates #409

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-06-02 18:12:05 +02:00
parent 73c40c77b0
commit 364a8508b2
3 changed files with 19 additions and 1 deletions

View File

@@ -654,6 +654,9 @@ func (b *LocalBackend) SetPrefs(new *Prefs) {
oldHi := b.hiCache
newHi := oldHi.Clone()
newHi.RoutableIPs = append([]wgcfg.CIDR(nil), b.prefs.AdvertiseRoutes...)
if h := new.Hostname; h != "" {
newHi.Hostname = h
}
b.hiCache = newHi
b.mu.Unlock()