Skip to content

Commit

Permalink
Update:
Browse files Browse the repository at this point in the history
Add Chinese translation to multiple doc.go file and
copyright year to 2024 in multiple source files
  • Loading branch information
TochusC committed Oct 23, 2024
1 parent c263a99 commit 79ed37a
Show file tree
Hide file tree
Showing 131 changed files with 962 additions and 804 deletions.
6 changes: 4 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

Copyright (c) 2024 TochusC. All rights reserved.
Copyright (c) 2012 Google, Inc. All rights reserved.
Copyright (c) 2009-2011 Andreas Krennmair. All rights reserved.

Expand All @@ -11,8 +13,8 @@ notice, this list of conditions and the following disclaimer.
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Andreas Krennmair, Google, nor the names of its
contributors may be used to endorse or promote products derived from
* Neither the name of Andreas Krennmair, Google, TochusC nor the names
of its contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Expand Down
21 changes: 15 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
# GoPacket
# TochusC/GoPacket
该库为`google/gopacket`的分支版本,除为 Go 提供了数据包解码功能外,特别地对layers/dns.go文件进行了修改,以进行DNS相关实验。

This library provides packet decoding capabilities for Go.
See [godoc](https://godoc.org/github.com/tochusc/gopacket) for more details.
## 引入的新特性🌟
- 支持构建并发送未知类型的Resource Recourd(RR),
- 添加对DNSSEC相关RR的基本支持

## 未来工作🛠️
- 进一步扩展对DNSSEC的支持
- 添加更多RR类型

有关更多详细信息,请参阅 [godoc](https://godoc.org/github.com/tochusc/gopacket)

[![Build Status](https://travis-ci.org/google/gopacket.svg?branch=master)](https://travis-ci.org/google/gopacket)
[![GoDoc](https://godoc.org/github.com/tochusc/gopacket?status.svg)](https://godoc.org/github.com/tochusc/gopacket)

Minimum Go version required is 1.5 except for pcapgo/EthernetHandle, afpacket, and bsdbpf which need at least 1.9 due to x/sys/unix dependencies.
最低 Go 版本要求是 1.9

最初从 Andreas Krennmair <ak@synflood.at> (http://github.com/akrennmair/gopcap) 编写的 gopcap 项目中分叉出来。

Originally forked from the gopcap project written by Andreas
Krennmair <ak@synflood.at> (http://github.com/akrennmair/gopcap).
`layers\dns.go`中的相关代码参考了 `gopacket\gopacket`(http://github.com/gopacket/gopacket) 项目,感谢他们的贡献!
10 changes: 6 additions & 4 deletions afpacket/afpacket.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2012 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
Expand Down Expand Up @@ -293,10 +294,11 @@ func (h *TPacket) releaseCurrentPacket() error {
// to old bytes when using ZeroCopyReadPacketData... if you need to keep data past
// the next time you call ZeroCopyReadPacketData, use ReadPacketData, which copies
// the bytes into a new buffer for you.
// tp, _ := NewTPacket(...)
// data1, _, _ := tp.ZeroCopyReadPacketData()
// // do everything you want with data1 here, copying bytes out of it if you'd like to keep them around.
// data2, _, _ := tp.ZeroCopyReadPacketData() // invalidates bytes in data1
//
// tp, _ := NewTPacket(...)
// data1, _, _ := tp.ZeroCopyReadPacketData()
// // do everything you want with data1 here, copying bytes out of it if you'd like to keep them around.
// data2, _, _ := tp.ZeroCopyReadPacketData() // invalidates bytes in data1
func (h *TPacket) ZeroCopyReadPacketData() (data []byte, ci gopacket.CaptureInfo, err error) {
h.mu.Lock()
retry:
Expand Down
2 changes: 2 additions & 0 deletions afpacket/afpacket_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2012 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree.

//go:build linux
// +build linux

package afpacket
Expand Down
2 changes: 2 additions & 0 deletions afpacket/header.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2012 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree.

//go:build linux
// +build linux

package afpacket
Expand Down
2 changes: 2 additions & 0 deletions afpacket/options.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2012 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree.

//go:build linux
// +build linux

package afpacket
Expand Down
2 changes: 2 additions & 0 deletions afpacket/sockopt_linux.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2012 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree.

//go:build linux
// +build linux

package afpacket
Expand Down
1 change: 1 addition & 0 deletions base.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2012 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
Expand Down
1 change: 1 addition & 0 deletions bsdbpf/bsd_bpf_sniffer.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2012 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
Expand Down
10 changes: 6 additions & 4 deletions bytediff/bytediff.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2012 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
Expand Down Expand Up @@ -95,10 +96,11 @@ func longestCommonSubstring(strA, strB []byte) (indexA, indexB, length int) {
// Difference represents a single part of the data being diffed, containing
// information about both the original and new values.
// From and To are the sets of bytes in the original and the new byte slice.
// !Replace implies From == To (no change)
// len(To) == 0 implies From is being deleted
// len(From) == 0 implies To is being inserted
// else implies From is being replaced by To
//
// !Replace implies From == To (no change)
// len(To) == 0 implies From is being deleted
// len(From) == 0 implies To is being inserted
// else implies From is being replaced by To
type Difference struct {
Replace bool
From, To []byte
Expand Down
1 change: 1 addition & 0 deletions bytediff/bytediff_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2012 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
Expand Down
22 changes: 12 additions & 10 deletions decode.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2012 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
Expand Down Expand Up @@ -28,16 +29,17 @@ var NilDecodeFeedback DecodeFeedback = nilDecodeFeedback{}
// PacketBuilder is used by layer decoders to store the layers they've decoded,
// and to defer future decoding via NextDecoder.
// Typically, the pattern for use is:
// func (m *myDecoder) Decode(data []byte, p PacketBuilder) error {
// if myLayer, err := myDecodingLogic(data); err != nil {
// return err
// } else {
// p.AddLayer(myLayer)
// }
// // maybe do this, if myLayer is a LinkLayer
// p.SetLinkLayer(myLayer)
// return p.NextDecoder(nextDecoder)
// }
//
// func (m *myDecoder) Decode(data []byte, p PacketBuilder) error {
// if myLayer, err := myDecodingLogic(data); err != nil {
// return err
// } else {
// p.AddLayer(myLayer)
// }
// // maybe do this, if myLayer is a LinkLayer
// p.SetLinkLayer(myLayer)
// return p.NextDecoder(nextDecoder)
// }
type PacketBuilder interface {
DecodeFeedback
// AddLayer should be called by a decoder immediately upon successful
Expand Down
6 changes: 4 additions & 2 deletions defrag/lcmdefrag/lcmdefrag.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2018 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
Expand Down Expand Up @@ -32,8 +33,9 @@ type lcmPacket struct {
// LCMDefragmenter supports defragmentation of LCM messages.
//
// References
// https://lcm-proj.github.io/
// https://github.com/lcm-proj/lcm
//
// https://lcm-proj.github.io/
// https://github.com/lcm-proj/lcm
type LCMDefragmenter struct {
packets map[uint32]*lcmPacket
}
Expand Down
1 change: 1 addition & 0 deletions defrag/lcmdefrag/lcmdefrag_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Copyright 2024 TochusC. All rights reserved.
// Copyright 2018 Google, Inc. All rights reserved.
//
// Use of this source code is governed by a BSD-style license
Expand Down
Loading

0 comments on commit 79ed37a

Please sign in to comment.