import path

This commit is contained in:
insanity
2018-08-15 16:17:18 +09:00
parent 3d28519fa1
commit 14ddc4feba
52 changed files with 310 additions and 779 deletions

View File

@@ -4,7 +4,7 @@ import (
"bytes"
"encoding/binary"
csm "git.loafle.net/commons/service_matcher-go"
osm "git.loafle.net/overflow/service_matcher-go"
)
const (
@@ -28,7 +28,7 @@ type RMI_RECV_MESSAGE struct {
}
type RMIMatcher struct {
csm.Matchers
osm.Matchers
}
func (r *RMIMatcher) Key() string {
@@ -39,7 +39,7 @@ func (r *RMIMatcher) Name() string {
return "RMI"
}
func (r *RMIMatcher) Meta() csm.Metadata {
func (r *RMIMatcher) Meta() osm.Metadata {
return nil
}
@@ -51,14 +51,14 @@ func (r *RMIMatcher) HasResponse(index int) bool {
return true
}
func (r *RMIMatcher) IsError(info csm.MatchInfo, index int, packet *csm.Packet) bool {
func (r *RMIMatcher) IsError(info osm.MatchInfo, index int, packet *osm.Packet) bool {
return false
}
func (r *RMIMatcher) Match(info csm.MatchInfo, index int, packet *csm.Packet) error {
func (r *RMIMatcher) Match(info osm.MatchInfo, index int, packet *osm.Packet) error {
if packet == nil || packet.Buffer == nil || packet.Len == 0 {
return csm.NoPacketReceivedError()
return osm.NoPacketReceivedError()
}
rmiRecv := RMI_RECV_MESSAGE{}
@@ -83,10 +83,10 @@ func (r *RMIMatcher) Match(info csm.MatchInfo, index int, packet *csm.Packet) er
return nil
}
return csm.NotMatchedError()
return osm.NotMatchedError()
}
func NewMatcher() csm.Matcher {
func NewMatcher() osm.Matcher {
m := &RMIMatcher{}
rsm := RMI_SEND_MESSAGE{
@@ -100,7 +100,7 @@ func NewMatcher() csm.Matcher {
sendByte := mCache.Bytes()
m.AddPacket(csm.NewPacket(sendByte, len(sendByte)))
m.AddPacket(osm.NewPacket(sendByte, len(sendByte)))
return m
}

View File

@@ -4,7 +4,7 @@ import (
"net"
"testing"
csm "git.loafle.net/commons/service_matcher-go"
osm "git.loafle.net/overflow/service_matcher-go"
)
func TestRMIMatcher_Match(t *testing.T) {
@@ -25,7 +25,7 @@ func TestRMIMatcher_Match(t *testing.T) {
}
bytes := make([]byte, 1024)
n, _ := conn.Read(bytes)
p := csm.NewPacket(bytes, n)
p := osm.NewPacket(bytes, n)
if err := m.Match(nil, i, p); err != nil {
t.Error(err)