mirror of
https://github.com/luscis/openlan.git
synced 2025-10-20 15:45:50 +08:00
fea: openudp: update link state
This commit is contained in:
28
pkg/libol/udpin_test.go
Normal file
28
pkg/libol/udpin_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package libol
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestOpenUDP_C(t *testing.T) {
|
||||
udp := &UdpInServer{Port: 4500}
|
||||
err := udp.Open()
|
||||
assert.Equal(t, nil, err, "has not error")
|
||||
assert.NotEqual(t, -1, udp.Socket, "valid socket")
|
||||
|
||||
go func() {
|
||||
conn, err := udp.Recv()
|
||||
fmt.Println(conn, err)
|
||||
}()
|
||||
|
||||
err = udp.Send(&UdpInConnection{
|
||||
Spi: 84209,
|
||||
RemoteAddr: "180.109.49.146",
|
||||
RemotePort: 4500,
|
||||
})
|
||||
assert.Equal(t, nil, err, "has not error")
|
||||
time.Sleep(time.Second * 2)
|
||||
}
|
Reference in New Issue
Block a user