Lorenz Brun | dd8c80e | 2019-10-07 16:19:49 +0200 | [diff] [blame] | 1 | // Copyright 2020 The Monogon Project Authors. |
| 2 | // |
| 3 | // SPDX-License-Identifier: Apache-2.0 |
| 4 | // |
| 5 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | // you may not use this file except in compliance with the License. |
| 7 | // You may obtain a copy of the License at |
| 8 | // |
| 9 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | // |
| 11 | // Unless required by applicable law or agreed to in writing, software |
| 12 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | // See the License for the specific language governing permissions and |
| 15 | // limitations under the License. |
| 16 | |
Serge Bazanski | 77cb6c5 | 2020-12-19 00:09:22 +0100 | [diff] [blame] | 17 | package node |
Hendrik Hofstadt | 0d7c91e | 2019-10-23 21:44:47 +0200 | [diff] [blame] | 18 | |
Serge Bazanski | 52304a8 | 2021-10-29 16:56:18 +0200 | [diff] [blame^] | 19 | // Port is a TCP and/or UDP port number reserved for and used by Metropolis |
| 20 | // node code. |
| 21 | type Port uint16 |
| 22 | |
Serge Bazanski | 77cb6c5 | 2020-12-19 00:09:22 +0100 | [diff] [blame] | 23 | const ( |
Serge Bazanski | 52304a8 | 2021-10-29 16:56:18 +0200 | [diff] [blame^] | 24 | // CuratorServicePort is the TCP port on which the Curator listens for gRPC |
| 25 | // calls and services Management/AAA/Curator RPCs. |
| 26 | CuratorServicePort Port = 7835 |
| 27 | // ConsensusPort is the TCP port on which etcd listens for peer traffic. |
| 28 | ConsensusPort Port = 7834 |
| 29 | // DebugServicePort is the TCP port on which the debug service serves gRPC |
| 30 | // traffic. This is only available in debug builds. |
| 31 | DebugServicePort Port = 7837 |
| 32 | // WireGuardPort is the UDP port on which the Wireguard Kubernetes network |
| 33 | // overlay listens for incoming peer traffic. |
| 34 | WireGuardPort Port = 7838 |
| 35 | // KubernetesAPIPort is the TCP port on which the Kubernetes API is |
| 36 | // exposed. |
| 37 | KubernetesAPIPort Port = 6443 |
| 38 | // DebuggerPort is the port on which the delve debugger runs (on debug |
| 39 | // builds only). Not to be confused with DebugServicePort. |
| 40 | DebuggerPort Port = 2345 |
Serge Bazanski | 77cb6c5 | 2020-12-19 00:09:22 +0100 | [diff] [blame] | 41 | ) |
Serge Bazanski | 52304a8 | 2021-10-29 16:56:18 +0200 | [diff] [blame^] | 42 | |
| 43 | func (p Port) String() string { |
| 44 | switch p { |
| 45 | case CuratorServicePort: |
| 46 | return "curator" |
| 47 | case ConsensusPort: |
| 48 | return "consensus" |
| 49 | case DebugServicePort: |
| 50 | return "debug" |
| 51 | case WireGuardPort: |
| 52 | return "wireguard" |
| 53 | case KubernetesAPIPort: |
| 54 | return "kubernetes-api" |
| 55 | case DebuggerPort: |
| 56 | return "delve" |
| 57 | } |
| 58 | return "unknown" |
| 59 | } |