mirror of
				https://github.com/e1732a364fed/v2ray_simple.git
				synced 2025-10-31 12:06:21 +08:00 
			
		
		
		
	修订代码
This commit is contained in:
		| @@ -1,7 +1,28 @@ | ||||
| package netLayer | ||||
|  | ||||
| import "testing" | ||||
| import ( | ||||
| 	"net" | ||||
| 	"testing" | ||||
| 	"time" | ||||
|  | ||||
| 	"github.com/hahahrfool/v2ray_simple/utils" | ||||
| ) | ||||
|  | ||||
| func TestIpv6(t *testing.T) { | ||||
| 	t.Log("HasIpv6Interface()", HasIpv6Interface()) | ||||
| } | ||||
|  | ||||
| func TestUDP(t *testing.T) { | ||||
| 	//测试setdeadline的情况. 实测证明 SetReadDeadline 在Read过程中也可以使用, 这样就可以防止阻塞 | ||||
|  | ||||
| 	laddr, _ := net.ResolveUDPAddr("udp", ":"+RandPortStr()) | ||||
|  | ||||
| 	udpConn, _ := net.ListenUDP("udp", laddr) | ||||
|  | ||||
| 	go func() { | ||||
| 		time.Sleep(time.Second) | ||||
| 		udpConn.SetReadDeadline(time.Now()) | ||||
| 	}() | ||||
| 	udpConn.ReadFrom(utils.GetPacket()) | ||||
| 	t.Log("ok") | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 hahahrfool
					hahahrfool