mirror of https://github.com/tidwall/evio.git
fixed code format
This commit is contained in:
parent
f416191b31
commit
08622c142f
14
README.md
14
README.md
|
@ -165,23 +165,21 @@ var mu sync.Mutex
|
||||||
var execs = make(map[int]int)
|
var execs = make(map[int]int)
|
||||||
|
|
||||||
events.Serving = func(srvin evio.Server) (action evio.Action) {
|
events.Serving = func(srvin evio.Server) (action evio.Action) {
|
||||||
srv = srvin // hang on to the server control, which has the Dial function
|
srv = srvin // hang on to the server control, which has the Dial function
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
events.Data = func(id int, in []byte) (out []byte, action evio.Action) {
|
events.Data = func(id int, in []byte) (out []byte, action evio.Action) {
|
||||||
if string(in) == "dial\r\n" {
|
if string(in) == "dial\r\n" {
|
||||||
id := srv.Dial("tcp://google.com:80")
|
id := srv.Dial("tcp://google.com:80")
|
||||||
// We now established an outbound connection to google.
|
// We now established an outbound connection to google.
|
||||||
// Treat it like you would incoming connection.
|
// Treat it like you would incoming connection.
|
||||||
} else {
|
} else {
|
||||||
out = in
|
out = in
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Data translations
|
### Data translations
|
||||||
|
|
||||||
The `Translate` function wraps events and provides a `ReadWriter` that can be used to translate data off the wire from one format to another. This can be useful for transparently adding compression or encryption.
|
The `Translate` function wraps events and provides a `ReadWriter` that can be used to translate data off the wire from one format to another. This can be useful for transparently adding compression or encryption.
|
||||||
|
|
Loading…
Reference in New Issue