34 lines
439 B
Go
34 lines
439 B
Go
package main
|
|
|
|
import (
|
|
"bufio"
|
|
"io"
|
|
"net"
|
|
|
|
"github.com/wayneashleyberry/rot13"
|
|
)
|
|
|
|
func main() {
|
|
ln, err := net.Listen("tcp", ":9000")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
defer ln.Close()
|
|
|
|
for {
|
|
conn, err := ln.Accept()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
go func() {
|
|
scanner := bufio.NewScanner(conn)
|
|
for scanner.Scan() {
|
|
str := scanner.Text()
|
|
io.WriteString(conn, rot13.Encode(str))
|
|
}
|
|
conn.Close()
|
|
}()
|
|
}
|
|
}
|