(device protocol.Device, introducerCfg config.DeviceConfiguration)
| 1843 | } |
| 1844 | |
| 1845 | func (m *model) introduceDevice(device protocol.Device, introducerCfg config.DeviceConfiguration) config.DeviceConfiguration { |
| 1846 | addresses := []string{"dynamic"} |
| 1847 | for _, addr := range device.Addresses { |
| 1848 | if addr != "dynamic" { |
| 1849 | addresses = append(addresses, addr) |
| 1850 | } |
| 1851 | } |
| 1852 | |
| 1853 | slog.Info("Adding device to config (vouched for by introducer)", device.ID.LogAttr(), slog.Any("introducer", introducerCfg.DeviceID.Short())) |
| 1854 | newDeviceCfg := m.cfg.DefaultDevice() |
| 1855 | newDeviceCfg.DeviceID = device.ID |
| 1856 | newDeviceCfg.Name = device.Name |
| 1857 | newDeviceCfg.Compression = introducerCfg.Compression |
| 1858 | newDeviceCfg.Addresses = addresses |
| 1859 | newDeviceCfg.CertName = device.CertName |
| 1860 | newDeviceCfg.IntroducedBy = introducerCfg.DeviceID |
| 1861 | |
| 1862 | // The introducers' introducers are also our introducers. |
| 1863 | if device.Introducer { |
| 1864 | slog.Info("Device is now also an introducer", device.ID.LogAttr()) |
| 1865 | newDeviceCfg.Introducer = true |
| 1866 | newDeviceCfg.SkipIntroductionRemovals = device.SkipIntroductionRemovals |
| 1867 | } |
| 1868 | |
| 1869 | return newDeviceCfg |
| 1870 | } |
| 1871 | |
| 1872 | // Closed is called when a connection has been closed |
| 1873 | func (m *model) Closed(conn protocol.Connection, err error) { |
no test coverage detected