cutover.go 653 B

1234567891011121314151617181920
  1. package p2p
  2. import (
  3. "strings"
  4. )
  5. // cutOverBootstrapPeers updates the bootstrap peers to reflect the new quic-v1. It assumes that the string has previously been validated.
  6. func cutOverBootstrapPeers(bootstrapPeers string) string {
  7. return strings.ReplaceAll(bootstrapPeers, "/quic/", "/quic-v1/")
  8. }
  9. // cutOverAddressPattern updates the address patterns. It assumes that the string is valid.
  10. func cutOverAddressPattern(pattern string) string {
  11. if !strings.Contains(pattern, "/quic-v1") {
  12. // These patterns are hardcoded so we are not worried about invalid values.
  13. pattern = strings.ReplaceAll(pattern, "/quic", "/quic-v1")
  14. }
  15. return pattern
  16. }