MCPcopy
hub / github.com/syncthing/syncthing / checkShortIDs

Function checkShortIDs

lib/syncthing/syncthing.go:430–440  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

428// short ID:s; that is, that the devices in the cluster all have unique
429// initial 64 bits.
430func 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
442type supervisor interface{ Services() []suture.Service }
443

Callers 2

TestShortIDCheckFunction · 0.85
startupMethod · 0.85

Calls 2

ShortMethod · 0.80
DevicesMethod · 0.65

Tested by 1

TestShortIDCheckFunction · 0.68