zone

package
v0.0.0-...-72e79e1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2016, Cossack Labs Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var FAKE_DB_BYTE = errors.New("Fake db format byte")
View Source
var ZONE_ID_BLOCK_LENGTH = int(ZONE_TAG_LENGTH + ZONE_ID_LENGTH)
View Source
var ZONE_ID_LENGTH = 16
View Source
var ZONE_TAG_LENGTH = len(ZONE_ID_BEGIN)
View Source
var ZONE_TAG_SYMBOL byte = 'D'

were chosen upper symbols because if data is text than it's less possible to catch three upper consonants in a row var ZONE_ID_BEGIN = []byte{'Z', 'X', 'C'} '44' - D - 68 - 0b1000100

Functions

func GenerateZoneId

func GenerateZoneId() []byte

func ZoneDataToJson

func ZoneDataToJson(id []byte, publicKey *keys.PublicKey) ([]byte, error)

Types

type BaseMatcher

type BaseMatcher struct {
	// contains filtered or unexported fields
}

func (*BaseMatcher) GetZoneId

func (matcher *BaseMatcher) GetZoneId() []byte

func (*BaseMatcher) HasAnyMatch

func (matcher *BaseMatcher) HasAnyMatch() bool

func (*BaseMatcher) IsMatched

func (matcher *BaseMatcher) IsMatched() bool

func (*BaseMatcher) Match

func (matcher *BaseMatcher) Match(c byte) bool

func (*BaseMatcher) Reset

func (matcher *BaseMatcher) Reset()

type BinaryByteReader

type BinaryByteReader struct{}

func NewBinaryByteReader

func NewBinaryByteReader() *BinaryByteReader

func (*BinaryByteReader) GetBuffered

func (reader *BinaryByteReader) GetBuffered() []byte

func (*BinaryByteReader) ReadByte

func (reader *BinaryByteReader) ReadByte(c byte) (bool, byte, error)

func (*BinaryByteReader) Reset

func (reader *BinaryByteReader) Reset()

type DbByteReader

type DbByteReader interface {
	ReadByte(c byte) (bool, byte, error)
	GetBuffered() []byte
	Reset()
}

type KeyChecker

type KeyChecker interface {
	HasZonePrivateKey([]byte) bool
}

type Matcher

type Matcher interface {
	Match(byte) bool
	Reset()
	GetZoneId() []byte
	IsMatched() bool
	HasAnyMatch() bool
}

func NewBaseMatcher

func NewBaseMatcher(dbReader DbByteReader) Matcher

func NewPgMatcher

func NewPgMatcher(dbReader DbByteReader) Matcher

type MatcherFactory

type MatcherFactory interface {
	CreateMatcher() Matcher
}

func NewPgEscapeMatcherFactory

func NewPgEscapeMatcherFactory() MatcherFactory

func NewPgHexMatcherFactory

func NewPgHexMatcherFactory() MatcherFactory

type MatcherPool

type MatcherPool struct {
	// contains filtered or unexported fields
}

func NewMatcherPool

func NewMatcherPool(factory MatcherFactory) *MatcherPool

func (*MatcherPool) Acquire

func (pool *MatcherPool) Acquire() Matcher

func (*MatcherPool) Release

func (pool *MatcherPool) Release(matcher Matcher)

type PgEscapeByteReader

type PgEscapeByteReader struct {
	// contains filtered or unexported fields
}

func NewPgEscapeByteReader

func NewPgEscapeByteReader() *PgEscapeByteReader

func (*PgEscapeByteReader) GetBuffered

func (reader *PgEscapeByteReader) GetBuffered() []byte

func (*PgEscapeByteReader) ReadByte

func (reader *PgEscapeByteReader) ReadByte(c byte) (bool, byte, error)

func (*PgEscapeByteReader) Reset

func (reader *PgEscapeByteReader) Reset()

type PgEscapeMatcherFactory

type PgEscapeMatcherFactory struct{}

func (*PgEscapeMatcherFactory) CreateMatcher

func (*PgEscapeMatcherFactory) CreateMatcher() Matcher

type PgHexByteReader

type PgHexByteReader struct {
	// contains filtered or unexported fields
}

func NewPgHexByteReader

func NewPgHexByteReader() *PgHexByteReader

func (*PgHexByteReader) GetBuffered

func (reader *PgHexByteReader) GetBuffered() []byte

func (*PgHexByteReader) ReadByte

func (reader *PgHexByteReader) ReadByte(c byte) (bool, byte, error)

func (*PgHexByteReader) Reset

func (reader *PgHexByteReader) Reset()

type PgHexMatcherFactory

type PgHexMatcherFactory struct{}

func (*PgHexMatcherFactory) CreateMatcher

func (*PgHexMatcherFactory) CreateMatcher() Matcher

type PgMatcher

type PgMatcher struct {
	// contains filtered or unexported fields
}

func (*PgMatcher) GetZoneId

func (matcher *PgMatcher) GetZoneId() []byte

func (*PgMatcher) HasAnyMatch

func (matcher *PgMatcher) HasAnyMatch() bool

func (*PgMatcher) IsMatched

func (matcher *PgMatcher) IsMatched() bool

func (*PgMatcher) Match

func (matcher *PgMatcher) Match(c byte) bool

func (*PgMatcher) Reset

func (matcher *PgMatcher) Reset()

type ZoneIdMatcher

type ZoneIdMatcher struct {
	// contains filtered or unexported fields
}

func NewZoneMatcher

func NewZoneMatcher(matcherPool *MatcherPool, keychecker KeyChecker) *ZoneIdMatcher

func (*ZoneIdMatcher) GetZoneId

func (zoneMatcher *ZoneIdMatcher) GetZoneId() []byte

func (*ZoneIdMatcher) IsMatched

func (zoneMatcher *ZoneIdMatcher) IsMatched() bool

func (*ZoneIdMatcher) Match

func (zoneMatcher *ZoneIdMatcher) Match(c byte) bool

func (*ZoneIdMatcher) Reset

func (zoneMatcher *ZoneIdMatcher) Reset()

func (*ZoneIdMatcher) SetMatched

func (zoneMatcher *ZoneIdMatcher) SetMatched(id []byte)

Jump to

Keyboard shortcuts

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