| 
									
										
										
										
											2018-07-21 21:45:42 +00:00
										 |  |  | # chat.go
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-21 21:58:05 -06:00
										 |  |  | Rudimentary go chat server as a fun project. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Install
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | git clone https://git.coolaj86.com/coolaj86/chat.go.git | 
					
						
							| 
									
										
										
										
											2018-08-01 19:13:10 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-29 16:58:15 -06:00
										 |  |  | go get gopkg.in/yaml.v2 | 
					
						
							| 
									
										
										
										
											2018-07-31 01:44:45 -06:00
										 |  |  | go get github.com/emicklei/go-restful | 
					
						
							| 
									
										
										
										
											2018-07-21 21:58:05 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-01 19:13:10 -06:00
										 |  |  | Note: I also copied some code directly from | 
					
						
							|  |  |  | <https://github.com/polvi/sni/blob/master/sni.go> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-21 21:58:05 -06:00
										 |  |  | # Usage
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-29 17:04:05 -06:00
										 |  |  | **Start the server** | 
					
						
							| 
									
										
										
										
											2018-07-21 21:58:05 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							| 
									
										
										
										
											2018-08-02 01:10:26 -06:00
										 |  |  | go run -race chatserver*.go -conf ./config.yml | 
					
						
							| 
									
										
										
										
											2018-07-21 21:58:05 -06:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-29 17:04:05 -06:00
										 |  |  | See sample config file at `config.sample.yml`. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | **Connect clients** | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | You can connect multiple clients. | 
					
						
							| 
									
										
										
										
											2018-07-21 21:58:05 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | telnet localhost 4080 | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2018-08-01 19:13:10 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | You can also use HTTP. The API docs and examples can be seen at <http://localhost:4080> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | curl http://localhost:4080 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Implemented | 
					
						
							|  |  |  | ----- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * [x] Awesome telnet server (would | 
					
						
							|  |  |  | * [x] HTTP API (no UI for the sake of time) | 
					
						
							|  |  |  | * [x] Multiplex the same port (because I wanted to learn) | 
					
						
							|  |  |  | * [x] E-mail "magic link" authentication (minus the link since it's localhost) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Not Implemented | 
					
						
							|  |  |  | ---- | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | * [ ] Write to log file (just `go run ./chatserver.go > /path/to/log` | 
					
						
							|  |  |  | * [ ] Rooms |