mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-13 11:53:41 +00:00
BitTorrent HTTP、UDP tracker impl(50%)
This commit is contained in:
1 parent
808035094c
commit
41ff983b73
16 files changed
+600
-25
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
func main() {
|
||||
ip := net.ParseIP("127.0.0.1")
|
||||
srcAddr := &net.UDPAddr{IP: net.IPv4zero, Port: 0}
|
||||
dstAddr := &net.UDPAddr{IP: ip, Port: 9981}
|
||||
conn, err := net.DialUDP("udp", srcAddr, dstAddr)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
conn.Write([]byte("hello"))
|
||||
conn.Write([]byte("test"))
|
||||
conn.Read([]byte{})
|
||||
fmt.Printf("<%s>\n", conn.RemoteAddr())
|
||||
}
|
||||
Reference in new issue
Block a user