MCPcopy Index your code
hub / github.com/foxcpp/maddy / ConnUnnamed

Method ConnUnnamed

tests/t.go:465–484  ·  view source on GitHub ↗
(port uint16)

Source from the content-addressed store, hash-verified

463)
464
465func (t *T) ConnUnnamed(port uint16) Conn {
466 conn, err := net.DialTCP("tcp4", &net.TCPAddr{
467 IP: DefaultSourceIP,
468 Port: 0,
469 }, &net.TCPAddr{
470 IP: net.IPv4(127, 0, 0, 1),
471 Port: int(port),
472 })
473 if err != nil {
474 t.Fatal("Could not connect, is server listening?", err)
475 }
476
477 return Conn{
478 T: t,
479 WriteTimeout: 1 * time.Second,
480 ReadTimeout: 15 * time.Second,
481 Conn: conn,
482 Scanner: bufio.NewScanner(conn),
483 }
484}
485
486func (t *T) Conn(portName string) Conn {
487 port := t.ports[portName]

Callers 2

ConnMethod · 0.95

Calls

no outgoing calls

Tested by 1