https://github.com/bigjk/telly
Minimal Telnet Server in go
https://github.com/bigjk/telly
golang mud telnet telnet-protocol telnet-server
Last synced: 8 months ago
JSON representation
Minimal Telnet Server in go
- Host: GitHub
- URL: https://github.com/bigjk/telly
- Owner: BigJk
- License: mit
- Created: 2021-03-10T14:32:15.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-10T14:55:52.000Z (over 5 years ago)
- Last Synced: 2025-06-03T20:08:45.386Z (about 1 year ago)
- Topics: golang, mud, telnet, telnet-protocol, telnet-server
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# telly
Minimal Telnet Server I wrote for a MUD backend.
## Get it
```
go get github.com/BigJk/telly
```
## Example
```go
package main
import (
"fmt"
"github.com/BigJk/telly"
"time"
)
func main() {
listener, err := telly.Listen(":5050")
if err != nil {
panic(err)
}
// If no message is received for 60 seconds close connection.
listener.SetTimeout(time.Second * 60)
for {
if conn, err := listener.Accept(); err == nil {
conn.SetMessageHandler(func(conn *telly.Conn, s string) {
fmt.Println(s)
_ = conn.Write(s)
})
conn.SetDisconnectHandler(func(conn *telly.Conn) {
fmt.Println(conn.RemoteAddr(), "disconnected")
})
fmt.Println(conn.RemoteAddr(), "connected")
}
}
}
```
## Why didn't I use ``github.com/reiver/go-telnet``?
The Project might be RFC conform but seems abondoned and doesn't support two crucial features. There is no clear way to close a connection from the server side and no support for custom timeouts. Without custom timeouts it's easy to overflow a server with idle connections.
## Used References
- https://github.com/Frimkron/mud-pi/blob/master/mudserver.py#L327
- http://pcmicro.com/netfoss/telnet.html