|
|
@ -21,17 +21,26 @@ type TELNETServer struct {
|
|
|
|
|
|
|
|
|
|
|
|
func NewTELNETServer(c context.Context, l net.Listener, p message.Publisher, wml watermill.LoggerAdapter) *TELNETServer {
|
|
|
|
func NewTELNETServer(c context.Context, l net.Listener, p message.Publisher, wml watermill.LoggerAdapter) *TELNETServer {
|
|
|
|
ts := TELNETServer{
|
|
|
|
ts := TELNETServer{
|
|
|
|
c: c,
|
|
|
|
c: c,
|
|
|
|
l: l,
|
|
|
|
l: l,
|
|
|
|
p: p,
|
|
|
|
p: p,
|
|
|
|
logger: wml,
|
|
|
|
logger: wml.With(
|
|
|
|
|
|
|
|
watermill.LogFields{
|
|
|
|
|
|
|
|
"name": "TELNETServer",
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return &ts
|
|
|
|
return &ts
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (ts *TELNETServer) Accept() (net.Conn, error) {
|
|
|
|
func (ts *TELNETServer) Accept() (net.Conn, error) {
|
|
|
|
return ts.l.Accept()
|
|
|
|
conn, err := ts.l.Accept()
|
|
|
|
|
|
|
|
ts.logger.Trace("receiving telnet connection", watermill.LogFields{
|
|
|
|
|
|
|
|
"remoteAddr": conn.RemoteAddr(),
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
return conn, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (ts *TELNETServer) Handle(conn net.Conn) {
|
|
|
|
func (ts *TELNETServer) Handle(conn net.Conn) {
|
|
|
@ -43,7 +52,8 @@ func (ts *TELNETServer) Handle(conn net.Conn) {
|
|
|
|
correlationID := watermill.NewUUID()
|
|
|
|
correlationID := watermill.NewUUID()
|
|
|
|
ts.logger = ts.logger.With(
|
|
|
|
ts.logger = ts.logger.With(
|
|
|
|
watermill.LogFields{
|
|
|
|
watermill.LogFields{
|
|
|
|
"correlation_id": correlationID},
|
|
|
|
"correlation_id": correlationID,
|
|
|
|
|
|
|
|
},
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
for s.Scan() {
|
|
|
|
for s.Scan() {
|
|
|
|