internal

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSFCapacity = 1e6
	// FalsePositiveRate
	DefaultSFFPR  = 1e-6
	DefaultSFSlot = 10
)

Those suggest value are all set according to https://github.com/shadowsocks/shadowsocks-org/issues/44#issuecomment-281021054 Due to this package contains various internal implementation so const named with DefaultBR prefix

View Source
const EnvironmentPrefix = "SHADOWSOCKS_"
View Source
const FilePath = "bloomfilter.gob"

Variables

This section is empty.

Functions

func AddSalt

func AddSalt(b []byte)

AddSalt salt to filter

func CheckSalt

func CheckSalt(b []byte) bool

func TestSalt

func TestSalt(b []byte) bool

TestSalt returns true if salt is repeated

Types

type BloomRing

type BloomRing struct {
	SlotCapacity int
	SlotPosition int
	SlotCount    int
	EntryCounter int
	Slots        []bloom.Filter
	// contains filtered or unexported fields
}

func LoadBloomRing added in v1.1.0

func LoadBloomRing(filePath string) (*BloomRing, error)

func LoadOrCreateBloomRing added in v1.1.0

func LoadOrCreateBloomRing(filePath string, slot int, capacity int, falsePositiveRate float64) *BloomRing

func NewBloomRing

func NewBloomRing(slot int, capacity int, falsePositiveRate float64) *BloomRing

func (*BloomRing) Add

func (r *BloomRing) Add(b []byte)

func (*BloomRing) Check

func (r *BloomRing) Check(b []byte) bool

func (*BloomRing) Save added in v1.1.0

func (r *BloomRing) Save(filePath string) error

func (*BloomRing) Test

func (r *BloomRing) Test(b []byte) bool

Jump to

Keyboard shortcuts

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