Files
threshold/internal/bsr/protocol.go
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
507 B
Go
Raw Normal View History

// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package bsr
2023-04-19 12:33:52 -04:00
import "regexp"
// Protocol identifies the protocol of the data captured in a chunk.
type Protocol string
// ValidProtocol checks if a given Protocol is valid.
func ValidProtocol(p Protocol) bool {
return len(p) <= protocolSize
}
2023-04-19 12:33:52 -04:00
// ToText converts a protocol to a text-safe string
func (p Protocol) ToText() string {
re := regexp.MustCompile("[[:^ascii:]]")
t := re.ReplaceAllLiteralString(string(p), "")
return t
}