<commit_before>package bgp

// Path Attributes
type PathAttr interface {
	Len() int
	Flags() uint8
	Code() uint8
}

// Path attribute flags.
const (
	FlagOptional   = 1 << 8
	FlagTransitive = 1 << 7
	FlagPartial    = 1 << 6
	FlagLength     = 1 << 5
)

// PathHeader is the header each of the path attributes have
// in common.
type PathHeader struct {
	Flags uint8
	Code uint8
}

// Communites implements RFC 1997 COMMUNITIES path attribute.
type Community struct {
	Flags uint8
	Code uint8
	Value []uint32
}

// Origin implements the ORIGIN path attribute.
type Origin struct {
	Flags uint8
	Code uint8
	Value uint8
}

// AsPath implements the AS_PATH path attribute.
type AsPath struct {
	Flags uint8
	Code uint8
	Value []Path
}

// Path is used to encode the AS paths in the AsPath attribute
type Path struct {
	Type uint8 // Either AS_SET of AS_SEQUENCE
	Length uint8 // Number of AS numbers to follow
	AS []uint16
}

// Define the constants used for well-known path attributes in BGP.
const (<commit_msg>Prework to make working with path attributes sane<commit_after>package bgp

// Path Attributes
type PathAttr interface {
	Len() int
	Header() *PathHeader
}

// Path attribute flags.
const (
	FlagOptional   = 1 << 8
	FlagTransitive = 1 << 7
	FlagPartial    = 1 << 6
	FlagLength     = 1 << 5
)

// PathHeader is the header each of the path attributes have
// in common.
type PathHeader struct {
	Flags uint8
	Code  uint8
}

func (*p PathHeader) Flags() uint8 {
	return p.Flags
}

func (*p PathHeader) Code() uint8 {
	return p.Code
}

// Communites implements RFC 1997 COMMUNITIES path attribute.
type Community struct {
	*PathHeader
	Value []uint32
}

// Origin implements the ORIGIN path attribute.
type Origin struct {
	*PathHeader
	Value uint8
}

// AsPath implements the AS_PATH path attribute.
type AsPath struct {
	*PathHeader
	Value []Path
}

// Path is used to encode the AS paths in the AsPath attribute
type Path struct {
	Type   uint8 // Either AS_SET of AS_SEQUENCE
	Length uint8 // Number of AS numbers to follow
	AS     []uint16
}

// Define the constants used for well-known path attributes in BGP.
const (
{'fraction_non_alphanumeric': 0.07518796992481203, 'fraction_numerical': 0.02443609022556391, 'mean_word_length': 3.2923387096774195, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1702091', 'n_tokens_mistral': 688, 'n_tokens_neox': 653, 'n_words': 282}