Serge Bazanski | d4438d6 | 2021-05-23 13:37:30 +0200 | [diff] [blame^] | 1 | package ident |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | ) |
| 6 | |
| 7 | // Request is an ident protocol request, as seen by the client or server. |
| 8 | type Request struct { |
| 9 | // ClientPort is the port number on the client side of the indent protocol, |
| 10 | // ie. the port local to the ident client. |
| 11 | ClientPort uint16 |
| 12 | // ServerPort is the port number on the server side of the ident protocol, |
| 13 | // ie. the port local to the ident server. |
| 14 | ServerPort uint16 |
| 15 | } |
| 16 | |
| 17 | // encode encodes ths Request as per RFC1413, including the terminating \r\n. |
| 18 | func (r *Request) encode() []byte { |
| 19 | return []byte(fmt.Sprintf("%d,%d\r\n", r.ServerPort, r.ClientPort)) |
| 20 | } |