MCPcopy Index your code
hub / github.com/coder/coder / prefixesDifferent

Function prefixesDifferent

tailnet/configmaps.go:768–782  ·  view source on GitHub ↗

prefixesDifferent returns true if the two slices contain different prefixes where order doesn't matter.

(a, b []netip.Prefix)

Source from the content-addressed store, hash-verified

766// prefixesDifferent returns true if the two slices contain different prefixes
767// where order doesn't matter.
768func prefixesDifferent(a, b []netip.Prefix) bool {
769 if len(a) != len(b) {
770 return true
771 }
772 as := make(map[string]bool)
773 for _, p := range a {
774 as[p.String()] = true
775 }
776 for _, p := range b {
777 if !as[p.String()] {
778 return true
779 }
780 }
781 return false
782}
783
784// derpMapStringer converts a DERPMap into a readable string for logging, since
785// it includes pointers that we want to know the contents of, not actual pointer

Callers 2

setAddressesMethod · 0.85
setAddressesMethod · 0.85

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected