net/unix/dial.ha
raw| 1 | // SPDX-License-Identifier: MPL-2.0 |
| 2 | // (c) Hare authors <https://harelang.org> |
| 3 | |
| 4 | use net; |
| 5 | use net::dial; |
| 6 | |
| 7 | fn dial_unix(addr: str, service: str) (net::socket | dial::error) = { |
| 8 | match (connect(addr)) { |
| 9 | case let conn: net::socket => |
| 10 | return conn; |
| 11 | case let err: net::error => |
| 12 | return err; |
| 13 | }; |
| 14 | }; |
| 15 | |
| 16 | @init fn registerproto() void = { |
| 17 | dial::registerproto("unix", &dial_unix)!; |
| 18 | }; |