https://github.com/mjblack/telnet
A Crystal Shard for creating telnet servers and clients
https://github.com/mjblack/telnet
crystal crystal-lang crystal-language crystal-shard shard telnet telnet-protocol
Last synced: 7 months ago
JSON representation
A Crystal Shard for creating telnet servers and clients
- Host: GitHub
- URL: https://github.com/mjblack/telnet
- Owner: mjblack
- License: mit
- Created: 2025-02-08T20:24:28.000Z (8 months ago)
- Default Branch: master
- Last Pushed: 2025-02-26T21:12:40.000Z (8 months ago)
- Last Synced: 2025-02-26T21:30:10.977Z (8 months ago)
- Topics: crystal, crystal-lang, crystal-language, crystal-shard, shard, telnet, telnet-protocol
- Language: Crystal
- Homepage: https://mjblack.github.io/telnet/
- Size: 38.1 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# telnet
[](https://github.com/mjblack/telnet/actions/workflows/crystal.yml)
Telnet shard that provides server and client classes. It provides a parser class that handles telnet events with callbacks.## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
telnet:
github: mjblack/telnet
```2. Run `shards install`
## Usage
Please see [examples/simple_server.cr](https://github.com/mjblack/telnet/blob/master/examples/simple_server.cr) for a more detailed example that showcases telnet command and subnegotiation handling.
```crystal
require "telnet"server = Telnet::Server.new("0.0.0.0", 23)
server.on_connect do |session|
puts "New client connected: #{session.remote_address}"
dont_echo = Telnet::Command.new_dont(Telnet::Option::ECHO)
io.write(dont_echo)
puts "Sent dont echo"
endserver.on_disconnect do |session|
puts "Client disconnected: #{session.remote_address}"
endserver.on_wont_echo do |session|
puts "Client: WONT ECHO"
end# Spawns listener
server.listenwhile true
Fiber.yield
end```
## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request## Contributors
- [Matthew J. Black](https://github.com/mjblack) - creator and maintainer