Skip to content

Commit

Permalink
addr interface (gate/agent)
Browse files Browse the repository at this point in the history
  • Loading branch information
name5566 committed Feb 15, 2017
1 parent e216b1f commit 2c74d13
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gate/agent.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package gate

import (
"net"
)

type Agent interface {
WriteMsg(msg interface{})
LocalAddr() net.Addr
RemoteAddr() net.Addr
Close()
Destroy()
UserData() interface{}
Expand Down
9 changes: 9 additions & 0 deletions gate/gate.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/name5566/leaf/chanrpc"
"github.com/name5566/leaf/log"
"github.com/name5566/leaf/network"
"net"
"reflect"
"time"
)
Expand Down Expand Up @@ -130,6 +131,14 @@ func (a *agent) WriteMsg(msg interface{}) {
}
}

func (a *agent) LocalAddr() net.Addr {
return a.conn.LocalAddr()
}

func (a *agent) RemoteAddr() net.Addr {
return a.conn.RemoteAddr()
}

func (a *agent) Close() {
a.conn.Close()
}
Expand Down

0 comments on commit 2c74d13

Please sign in to comment.