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.
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.
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.
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.
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.
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.
Index ¶
- Variables
- func GenerateZoneId() []byte
- func ZoneDataToJson(id []byte, publicKey *keys.PublicKey) ([]byte, error)
- type BaseMatcher
- type BinaryByteReader
- type DbByteReader
- type KeyChecker
- type Matcher
- type MatcherFactory
- type MatcherPool
- type PgEscapeByteReader
- type PgEscapeMatcherFactory
- type PgHexByteReader
- type PgHexMatcherFactory
- type PgMatcher
- type ZoneIdMatcher
Constants ¶
This section is empty.
Variables ¶
var FAKE_DB_BYTE = errors.New("Fake db format byte")
var ZONE_ID_BEGIN = []byte{ZONE_TAG_SYMBOL, ZONE_TAG_SYMBOL, ZONE_TAG_SYMBOL, ZONE_TAG_SYMBOL, ZONE_TAG_SYMBOL, ZONE_TAG_SYMBOL, ZONE_TAG_SYMBOL, ZONE_TAG_SYMBOL}
var ZONE_ID_BLOCK_LENGTH = int(ZONE_TAG_LENGTH + ZONE_ID_LENGTH)
var ZONE_ID_LENGTH = 16
var ZONE_TAG_LENGTH = len(ZONE_ID_BEGIN)
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
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 KeyChecker ¶
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) HasAnyMatch ¶
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)