simpletoken

package
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package simpletoken contains a Detector for tokens that can be extracted by scanning a byte array with a regular expression.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detector

type Detector struct {
	// The maximum length of the token.
	MaxLen uint32
	// Matches on the token.
	Re *regexp.Regexp
	// Returns a veles.Secret from a regexp match.
	FromMatch func([]byte) veles.Secret
}

Detector finds instances of a simple token that matches the regular expression Re inside a chunk of text. It implements veles.Detector.

func (Detector) Detect

func (d Detector) Detect(data []byte) (secrets []veles.Secret, positions []int)

Detect finds candidate tokens that match Detector.Re and returns them alongside their starting positions.

func (Detector) MaxSecretLen

func (d Detector) MaxSecretLen() uint32

MaxSecretLen returns the maximum length of the token.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL