mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-13 21:54:13 +08:00
chore: refine comments in bittorrent.go
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
This commit is contained in:
parent
a00b1e06f4
commit
f97687e85f
@ -11,7 +11,7 @@ import (
|
||||
"github.com/sagernet/sing-box/constant"
|
||||
)
|
||||
|
||||
// BitTorrent detects if the input stream is a BitTorrent connection.
|
||||
// BitTorrent detects if the stream is a BitTorrent connection.
|
||||
// For the BitTorrent protocol specification, see https://www.bittorrent.org/beps/bep_0003.html
|
||||
func BitTorrent(_ context.Context, reader io.Reader) (*adapter.InboundContext, error) {
|
||||
var first byte
|
||||
@ -38,12 +38,12 @@ func BitTorrent(_ context.Context, reader io.Reader) (*adapter.InboundContext, e
|
||||
}, nil
|
||||
}
|
||||
|
||||
// UTP detects if the input packet is a uTP connection header.
|
||||
// UTP detects if the packet is a uTP connection packet.
|
||||
// For the uTP protocol specification, see
|
||||
// 1. https://www.bittorrent.org/beps/bep_0029.html
|
||||
// 2. https://github.com/bittorrent/libutp/blob/2b364cbb0650bdab64a5de2abb4518f9f228ec44/utp_internal.cpp#L112
|
||||
func UTP(_ context.Context, packet []byte) (*adapter.InboundContext, error) {
|
||||
// A valid UTP must be at least 20 bytes long.
|
||||
// A valid uTP packet must be at least 20 bytes long.
|
||||
if len(packet) < 20 {
|
||||
return nil, os.ErrInvalid
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user