-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
package pipe | ||
import "time" | ||
|
||
const ( | ||
//server spec cmd | ||
Invalid Cmd = iota | ||
Shutdown //自身服务关闭 | ||
Enter //远程连入 | ||
Leave //远程连出 | ||
Request | ||
Response | ||
) | ||
|
||
type Action byte | ||
|
||
//server common cmd | ||
type CommonErrMsgCmd struct { | ||
type RequestCmd struct { | ||
Id uint64 | ||
AccountName string | ||
Msg string | ||
Action Action | ||
Cmd string | ||
OverTime time.Time | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,30 @@ | ||
package remote | ||
import "flag" | ||
import "log" | ||
import "../pipe" | ||
|
||
var service = flag.String("service", "", "") | ||
var groupName = flag.String("group", "", "") | ||
var nickName = flag.String("nick", "", "") | ||
func Init() { | ||
flag.Parse() | ||
println("remote init") | ||
c:=make(chan *pipe.HelperInfo) | ||
go func() { | ||
for { | ||
select { | ||
case info:=<-c: | ||
switch info.Cmd { | ||
case pipe.Request: | ||
log.Println("request") | ||
case pipe.Response: | ||
log.Println("response") | ||
} | ||
} | ||
} | ||
}() | ||
client := pipe.NewInnerClient(*service, c) | ||
if client!=nil { | ||
client.Send(pipe.Request, "haha") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters