Bu işleme şunda yer alıyor:
AJ ONeal 2018-08-02 12:02:04 -06:00
ebeveyn 9c17248bfa
işleme c5100b35bf
2 değiştirilmiş dosya ile 12 ekleme ve 7 silme

Dosyayı Görüntüle

@ -83,6 +83,7 @@ func handleTelnetConn(bufConn bufferedConn) {
email = strings.TrimSpace(msg)
emailParts := strings.Split(email, "@")
if 2 != len(emailParts) {
email = ""
fmt.Fprintf(bufConn, "Email: ")
continue
}

Dosyayı Görüntüle

@ -10,7 +10,6 @@ import (
"encoding/base64"
"flag"
"fmt"
"io"
"io/ioutil"
"net"
"net/http"
@ -42,13 +41,13 @@ type ConfMailer struct {
// So we can peek at net.Conn, which we can't do natively
// https://stackoverflow.com/questions/51472020/how-to-get-the-size-of-available-tcp-data
type bufferedConn struct {
r *bufio.Reader
rout io.Reader // See https://github.com/polvi/sni/blob/master/sni.go#L135
r *bufio.Reader
//rout *io.Reader // See https://github.com/polvi/sni/blob/master/sni.go#L135
net.Conn
}
func newBufferedConn(c net.Conn) bufferedConn {
return bufferedConn{bufio.NewReader(c), nil, c}
return bufferedConn{bufio.NewReader(c), c}
}
func (b bufferedConn) Peek(n int) ([]byte, error) {
@ -60,9 +59,11 @@ func (b bufferedConn) Buffered() int {
}
func (b bufferedConn) Read(p []byte) (int, error) {
if b.rout != nil {
return b.rout.Read(p)
}
/*
if b.rout != nil {
return b.rout.Read(p)
}
*/
return b.r.Read(p)
}
@ -166,6 +167,9 @@ func muxTcp(conn bufferedConn) {
}
if "" == protocol {
// Throw away the first bytes
b := make([]byte, 4096)
conn.Read(b)
fmt.Fprintf(conn, "\n\nWelcome to Sample Chat! You're not an HTTP client, assuming Telnet.\nYou must authenticate via email to participate\n\nEmail: ")
wantsServerHello <- conn
return