This commit is contained in:
crusader 2018-10-23 11:44:37 +09:00
parent d14425f824
commit ae4182b89e
2 changed files with 21 additions and 3 deletions

16
Gopkg.lock generated
View File

@ -2,38 +2,52 @@
[[projects]]
digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
name = "github.com/davecgh/go-spew"
packages = ["spew"]
pruneopts = "UT"
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
version = "v1.1.1"
[[projects]]
digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
name = "github.com/pmezard/go-difflib"
packages = ["difflib"]
pruneopts = "UT"
revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0"
[[projects]]
digest = "1:274f67cb6fed9588ea2521ecdac05a6d62a8c51c074c1fccc6a49a40ba80e925"
name = "github.com/satori/go.uuid"
packages = ["."]
pruneopts = "UT"
revision = "f58768cc1a7a7e77a3bd49e98cdd21419399b6a3"
version = "v1.2.0"
[[projects]]
digest = "1:18752d0b95816a1b777505a97f71c7467a8445b8ffb55631a7bf779f6ba4fa83"
name = "github.com/stretchr/testify"
packages = ["assert"]
pruneopts = "UT"
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
version = "v1.2.2"
[[projects]]
digest = "1:81e1c5cee195fca5de06e2540cb63eea727a850b7e5c213548e7f81521c97a57"
name = "gopkg.in/asn1-ber.v1"
packages = ["."]
pruneopts = "UT"
revision = "379148ca0225df7a432012b8df0355c2a2063ac0"
version = "v1.2"
[solve-meta]
analyzer-name = "dep"
analyzer-version = 1
inputs-digest = "42705304701176173d344446cd1f46bfef849ef7bc78c789b6a70526b132567a"
input-imports = [
"github.com/satori/go.uuid",
"github.com/stretchr/testify/assert",
"gopkg.in/asn1-ber.v1",
]
solver-name = "gps-cdcl"
solver-version = 1

View File

@ -2,22 +2,26 @@ package echo
import (
"net"
"strconv"
"testing"
osm "git.loafle.net/overflow/service_matcher-go"
)
func TestEchoMatcher(t *testing.T) {
ip := "192.168.100.99"
port := 7
m := NewMatcher()
conn, err := net.Dial("tcp", "192.168.1.99:7")
conn, err := net.Dial("tcp", net.JoinHostPort(ip, strconv.Itoa(port)))
if err != nil {
t.Error(err)
return
}
defer conn.Close()
matchCtx := osm.NewMatchCtx("192.168.1.99", 7)
matchCtx := osm.NewMatchCtx(ip, port)
for i := 0; i < m.PacketCount(matchCtx); i++ {
_, err := conn.Write(m.Packet(matchCtx, i).Buffer)