mirror of
https://github.com/zr-hebo/sniffer-agent.git
synced 2025-08-09 11:45:18 +08:00
add vendor packages避免用户网络太慢无法下载编译
This commit is contained in:
24
vendor/github.com/eapache/go-xerial-snappy/.gitignore
generated
vendored
Normal file
24
vendor/github.com/eapache/go-xerial-snappy/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
*.prof
|
7
vendor/github.com/eapache/go-xerial-snappy/.travis.yml
generated
vendored
Normal file
7
vendor/github.com/eapache/go-xerial-snappy/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
language: go
|
||||
|
||||
go:
|
||||
- 1.5.4
|
||||
- 1.6.1
|
||||
|
||||
sudo: false
|
21
vendor/github.com/eapache/go-xerial-snappy/LICENSE
generated
vendored
Normal file
21
vendor/github.com/eapache/go-xerial-snappy/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Evan Huus
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
13
vendor/github.com/eapache/go-xerial-snappy/README.md
generated
vendored
Normal file
13
vendor/github.com/eapache/go-xerial-snappy/README.md
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# go-xerial-snappy
|
||||
|
||||
[](https://travis-ci.org/eapache/go-xerial-snappy)
|
||||
|
||||
Xerial-compatible Snappy framing support for golang.
|
||||
|
||||
Packages using Xerial for snappy encoding use a framing format incompatible with
|
||||
basically everything else in existence. This package wraps Go's built-in snappy
|
||||
package to support it.
|
||||
|
||||
Apps that use this format include Apache Kafka (see
|
||||
https://github.com/dpkp/kafka-python/issues/126#issuecomment-35478921 for
|
||||
details).
|
43
vendor/github.com/eapache/go-xerial-snappy/snappy.go
generated
vendored
Normal file
43
vendor/github.com/eapache/go-xerial-snappy/snappy.go
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
package snappy
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
|
||||
master "github.com/golang/snappy"
|
||||
)
|
||||
|
||||
var xerialHeader = []byte{130, 83, 78, 65, 80, 80, 89, 0}
|
||||
|
||||
// Encode encodes data as snappy with no framing header.
|
||||
func Encode(src []byte) []byte {
|
||||
return master.Encode(nil, src)
|
||||
}
|
||||
|
||||
// Decode decodes snappy data whether it is traditional unframed
|
||||
// or includes the xerial framing format.
|
||||
func Decode(src []byte) ([]byte, error) {
|
||||
if !bytes.Equal(src[:8], xerialHeader) {
|
||||
return master.Decode(nil, src)
|
||||
}
|
||||
|
||||
var (
|
||||
pos = uint32(16)
|
||||
max = uint32(len(src))
|
||||
dst = make([]byte, 0, len(src))
|
||||
chunk []byte
|
||||
err error
|
||||
)
|
||||
for pos < max {
|
||||
size := binary.BigEndian.Uint32(src[pos : pos+4])
|
||||
pos += 4
|
||||
|
||||
chunk, err = master.Decode(chunk, src[pos:pos+size])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
pos += size
|
||||
dst = append(dst, chunk...)
|
||||
}
|
||||
return dst, nil
|
||||
}
|
Reference in New Issue
Block a user