github.com/mysteriumnetwork/node@v0.0.0-20240516044423-365054f76801/tequilapi/contract/service.go (about) 1 /* 2 * Copyright (C) 2020 The "MysteriumNetwork/node" Authors. 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 package contract 19 20 // ServiceStartRequest request used to start a service. 21 // swagger:model ServiceStartRequestDTO 22 type ServiceStartRequest struct { 23 // provider identity 24 // required: true 25 // example: 0x0000000000000000000000000000000000000002 26 ProviderID string `json:"provider_id"` 27 28 // service type. Possible values are "openvpn", "wireguard" and "noop" 29 // required: true 30 // example: openvpn 31 Type string `json:"type"` 32 33 // access list which determines which identities will be able to receive the service 34 // required: false 35 AccessPolicies *ServiceAccessPolicies `json:"access_policies,omitempty"` 36 37 // service options. Every service has a unique list of allowed options. 38 // required: false 39 // example: {"port": 1123, "protocol": "udp"} 40 Options interface{} `json:"options"` 41 } 42 43 // ServiceAccessPolicies represents the access controls for service start 44 // swagger:model ServiceAccessPolicies 45 type ServiceAccessPolicies struct { 46 IDs []string `json:"ids"` 47 } 48 49 // ServiceListResponse represents a list of running services on the node. 50 // swagger:model ServiceListResponse 51 type ServiceListResponse []ServiceInfoDTO 52 53 // ServiceInfoDTO represents running service information. 54 // swagger:model ServiceInfoDTO 55 type ServiceInfoDTO struct { 56 // example: 6ba7b810-9dad-11d1-80b4-00c04fd430c8 57 ID string `json:"id,omitempty"` 58 59 // provider identity 60 // example: 0x0000000000000000000000000000000000000002 61 ProviderID string `json:"provider_id,omitempty"` 62 63 // service type. Possible values are "openvpn", "wireguard" and "noop" 64 // example: openvpn 65 Type string `json:"type"` 66 67 // options with which service was started. Every service has a unique list of allowed options. 68 // example: {"port": 1123, "protocol": "udp"} 69 Options interface{} `json:"options,omitempty"` 70 71 // example: Running 72 Status string `json:"status"` 73 74 Proposal *ProposalDTO `json:"proposal,omitempty"` 75 76 ConnectionStatistics *ServiceStatisticsDTO `json:"connection_statistics,omitempty"` 77 } 78 79 // ServiceStatisticsDTO shows the successful and attempted connection count 80 type ServiceStatisticsDTO struct { 81 Attempted int `json:"attempted"` 82 Successful int `json:"successful"` 83 }