浏览文件
sockets.go
33 行 · 520 B历史下载| 1 | // SPDX-FileCopyrightText: Copyright The Lima Authors |
| 2 | // SPDX-License-Identifier: Apache-2.0 |
| 3 | |
| 4 | package sockets |
| 5 | |
| 6 | import ( |
| 7 | "net" |
| 8 | ) |
| 9 | |
| 10 | type Kind = string |
| 11 | |
| 12 | const ( |
| 13 | TCP Kind = "tcp" |
| 14 | TCP6 Kind = "tcp6" |
| 15 | UDP Kind = "udp" |
| 16 | UDP6 Kind = "udp6" |
| 17 | // TODO: "udplite", "udplite6". |
| 18 | ) |
| 19 | |
| 20 | type State = byte |
| 21 | |
| 22 | const ( |
| 23 | TCPEstablished State = 0x1 |
| 24 | TCPListen State = 0xA |
| 25 | UDPUnconnected State = 0x7 |
| 26 | ) |
| 27 | |
| 28 | type Socket struct { |
| 29 | Kind Kind `json:"kind"` |
| 30 | IP net.IP `json:"ip"` |
| 31 | Port uint16 `json:"port"` |
| 32 | State State `json:"state"` |
| 33 | } |

