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]] [[projects]]
digest = "1:ffe9824d294da03b391f44e1ae8281281b4afc1bdaa9588c9097785e3af10cec"
name = "github.com/davecgh/go-spew" name = "github.com/davecgh/go-spew"
packages = ["spew"] packages = ["spew"]
pruneopts = "UT"
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73" revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
version = "v1.1.1" version = "v1.1.1"
[[projects]] [[projects]]
digest = "1:0028cb19b2e4c3112225cd871870f2d9cf49b9b4276531f03438a88e94be86fe"
name = "github.com/pmezard/go-difflib" name = "github.com/pmezard/go-difflib"
packages = ["difflib"] packages = ["difflib"]
pruneopts = "UT"
revision = "792786c7400a136282c1664665ae0a8db921c6c2" revision = "792786c7400a136282c1664665ae0a8db921c6c2"
version = "v1.0.0" version = "v1.0.0"
[[projects]] [[projects]]
digest = "1:274f67cb6fed9588ea2521ecdac05a6d62a8c51c074c1fccc6a49a40ba80e925"
name = "github.com/satori/go.uuid" name = "github.com/satori/go.uuid"
packages = ["."] packages = ["."]
pruneopts = "UT"
revision = "f58768cc1a7a7e77a3bd49e98cdd21419399b6a3" revision = "f58768cc1a7a7e77a3bd49e98cdd21419399b6a3"
version = "v1.2.0" version = "v1.2.0"
[[projects]] [[projects]]
digest = "1:18752d0b95816a1b777505a97f71c7467a8445b8ffb55631a7bf779f6ba4fa83"
name = "github.com/stretchr/testify" name = "github.com/stretchr/testify"
packages = ["assert"] packages = ["assert"]
pruneopts = "UT"
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686" revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
version = "v1.2.2" version = "v1.2.2"
[[projects]] [[projects]]
digest = "1:81e1c5cee195fca5de06e2540cb63eea727a850b7e5c213548e7f81521c97a57"
name = "gopkg.in/asn1-ber.v1" name = "gopkg.in/asn1-ber.v1"
packages = ["."] packages = ["."]
pruneopts = "UT"
revision = "379148ca0225df7a432012b8df0355c2a2063ac0" revision = "379148ca0225df7a432012b8df0355c2a2063ac0"
version = "v1.2" version = "v1.2"
[solve-meta] [solve-meta]
analyzer-name = "dep" analyzer-name = "dep"
analyzer-version = 1 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-name = "gps-cdcl"
solver-version = 1 solver-version = 1

View File

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