checkShortIDs verifies that the configuration won't result in duplicate short ID:s; that is, that the devices in the cluster all have unique initial 64 bits.
(cfg config.Wrapper)
| 428 | // short ID:s; that is, that the devices in the cluster all have unique |
| 429 | // initial 64 bits. |
| 430 | func checkShortIDs(cfg config.Wrapper) error { |
| 431 | exists := make(map[protocol.ShortID]protocol.DeviceID) |
| 432 | for deviceID := range cfg.Devices() { |
| 433 | shortID := deviceID.Short() |
| 434 | if otherID, ok := exists[shortID]; ok { |
| 435 | return fmt.Errorf("%v in conflict with %v", deviceID, otherID) |
| 436 | } |
| 437 | exists[shortID] = deviceID |
| 438 | } |
| 439 | return nil |
| 440 | } |
| 441 | |
| 442 | type supervisor interface{ Services() []suture.Service } |
| 443 |