Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{,x-pack/}packetbeat: remove dead code and unused fields, vars, consts and comments #30489

Merged
merged 2 commits into from
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions packetbeat/flows/flowid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ func addVLan(u []byte) applyAddr {
}
}

func addUDP(a, b []byte) applyAddr {
src := binary.LittleEndian.Uint16(a)
dst := binary.LittleEndian.Uint16(b)
return func(f *FlowID) {
f.AddUDP(src, dst)
}
}

func addTCP(a, b []byte) applyAddr {
src := binary.LittleEndian.Uint16(a)
dst := binary.LittleEndian.Uint16(b)
Expand Down
14 changes: 1 addition & 13 deletions packetbeat/npcap/npcap.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,7 @@
// specific language governing permissions and limitations
// under the License.

// Package npcap handles fetching and installing Npcap fow Windows.
//
// The npcap package interacts with a registry and download server that
// provides a current_version end point that serves a JSON message that
// corresponds to the this Go type:
//
// struct {
// Version string // The semverish version of the Npcap installer.
// URL string // The location of the Npcap installer.
// Hash string // The sha256 hash of the Npcap installer.
// }
//
// The URL field will point to the location of anb Npcap installer.
// Package npcap handles fetching and installing Npcap for Windows.
package npcap

import (
Expand Down
2 changes: 0 additions & 2 deletions packetbeat/npcap/npcap_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,4 @@

package npcap

func loadWinPCAP() error { return nil }

func reloadWinPCAP() error { return nil }
2 changes: 0 additions & 2 deletions packetbeat/npcap/npcap_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ package npcap

import "github.com/google/gopacket/pcap"

func loadWinPCAP() error { return pcap.LoadWinPCAP() }

func reloadWinPCAP() error {
err := pcap.UnloadWinPCAP()
if err != nil {
Expand Down
63 changes: 0 additions & 63 deletions packetbeat/protos/cassandra/internal/gocql/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,60 +271,6 @@ func (t Type) String() string {
}
}

const (
apacheCassandraTypePrefix = "org.apache.cassandra.db.marshal."
)

// get Apache Cassandra types
func getApacheCassandraType(class string) Type {
switch strings.TrimPrefix(class, apacheCassandraTypePrefix) {
case "AsciiType":
return TypeASCII
case "LongType":
return TypeBigInt
case "BytesType":
return TypeBlob
case "BooleanType":
return TypeBoolean
case "CounterColumnType":
return TypeCounter
case "DecimalType":
return TypeDecimal
case "DoubleType":
return TypeDouble
case "FloatType":
return TypeFloat
case "Int32Type":
return TypeInt
case "ShortType":
return TypeSmallInt
case "ByteType":
return TypeTinyInt
case "DateType", "TimestampType":
return TypeTimestamp
case "UUIDType", "LexicalUUIDType":
return TypeUUID
case "UTF8Type":
return TypeVarchar
case "IntegerType":
return TypeVarint
case "TimeUUIDType":
return TypeTimeUUID
case "InetAddressType":
return TypeInet
case "MapType":
return TypeMap
case "ListType":
return TypeList
case "SetType":
return TypeSet
case "TupleType":
return TypeTuple
default:
return TypeCustom
}
}

// error Types
type ErrType int

Expand Down Expand Up @@ -565,15 +511,6 @@ const (
flagHasMorePages int = 0x02
flagNoMetaData int = 0x04

// query flags
flagValues byte = 0x01
flagSkipMetaData byte = 0x02
flagPageSize byte = 0x04
flagWithPagingState byte = 0x08
flagWithSerialConsistency byte = 0x10
flagDefaultTimestamp byte = 0x20
flagWithNameValues byte = 0x40

// header flags
flagDefault byte = 0x00
flagCompress byte = 0x01
Expand Down
13 changes: 4 additions & 9 deletions packetbeat/protos/memcache/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,12 @@ import (
"errors"
)

var errNotImplemented = errors.New("not implemented")

// memcache text parser errors
var (
errParserCaughtInError = errors.New("memcache parser caught in error loop")
errParserUnknownCommand = errors.New("unknown memcache command found")
errNoMoreArgument = errors.New("no more command arguments")
errExpectedNumber = errors.New("expected number value")
errExpectedNoReply = errors.New("expected noreply in argument list")
errExpectedCRLF = errors.New("expected CRLF")
errExpectedKeys = errors.New("message has no keys")
)

Expand All @@ -49,11 +45,10 @@ var (

// memcache transaction/message errors
var (
errInvalidMessage = errors.New("message is invalid")
errMixOfBinaryAndText = errors.New("mix of binary and text in one connection")
errResponseUnknownTransaction = errors.New("response from unknown transaction")
errExpectedValueForMerge = errors.New("expected value to merge with")
errExpectedStatsForMerge = errors.New("expected stat response to merge with")
errInvalidMessage = errors.New("message is invalid")
errMixOfBinaryAndText = errors.New("mix of binary and text in one connection")
errExpectedValueForMerge = errors.New("expected value to merge with")
errExpectedStatsForMerge = errors.New("expected stat response to merge with")
)

// internal notes to be published with transaction
Expand Down
5 changes: 0 additions & 5 deletions packetbeat/scripts/mage/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ import (
devtools "github.com/elastic/beats/v7/dev-tools/mage"
)

const (
// configTemplateGlob matches Packetbeat protocol config file templates.
configTemplateGlob = "protos/*/_meta/config*.yml.tmpl"
)

var defaultDevice = map[string]string{
"darwin": "en0",
"linux": "any",
Expand Down