github.com/clubpay/ronykit/kit@v0.14.4-0.20240515065620-d0dace45cbc7/conn.go (about) 1 package kit 2 3 // Conn represents a connection between EdgeServer and client. 4 type Conn interface { 5 ConnID() uint64 6 ClientIP() string 7 Write(data []byte) (int, error) 8 WriteEnvelope(e *Envelope) error 9 Stream() bool 10 Walk(fn func(key string, val string) bool) 11 Get(key string) string 12 Set(key string, val string) 13 } 14 15 // RESTConn could be implemented by Gateway, so in Dispatcher user can check if Conn also implements 16 // RESTConn then it has more information about the RESTConn request. 17 type RESTConn interface { 18 Conn 19 GetMethod() string 20 GetHost() string 21 // GetRequestURI returns uri without Method and Host 22 GetRequestURI() string 23 // GetPath returns uri without Method, Host and Query parameters. 24 GetPath() string 25 SetStatusCode(code int) 26 Redirect(code int, url string) 27 WalkQueryParams(fn func(key string, val string) bool) 28 }