2022-11-07 18:23:09 +00:00
|
|
|
package main
|
2022-11-07 16:56:16 +00:00
|
|
|
|
|
|
|
import (
|
2022-11-07 18:43:37 +00:00
|
|
|
"io"
|
|
|
|
"log"
|
2022-11-07 16:56:16 +00:00
|
|
|
"net"
|
|
|
|
|
2022-11-07 19:01:00 +00:00
|
|
|
"protohackers/pkg/conn"
|
2022-11-07 16:56:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2023-09-15 21:20:51 +00:00
|
|
|
err := conn.StartSimpleTCP(smoketest)
|
2022-11-07 16:56:16 +00:00
|
|
|
if err != nil {
|
2022-11-07 18:43:37 +00:00
|
|
|
log.Fatalln(err)
|
2022-11-07 16:56:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-07 19:01:00 +00:00
|
|
|
func smoketest(c net.Conn) {
|
2022-11-07 19:06:30 +00:00
|
|
|
defer c.Close()
|
2022-11-07 19:01:00 +00:00
|
|
|
if _, err := io.Copy(c, c); err != nil {
|
2022-11-07 18:43:37 +00:00
|
|
|
log.Fatalln(err)
|
2022-11-07 16:56:16 +00:00
|
|
|
}
|
|
|
|
}
|