Add --type option for services across all 42 implementations

Support service_type for SRV records (minecraft, mumble, teamspeak, source, tcp, udp).
Each implementation now parses --type and sends service_type in the JSON payload.
This commit is contained in:
Russell Ballestrini 2025-12-26 08:39:34 -05:00
parent 564e9e7075
commit eb5d4ca8bf
42 changed files with 783 additions and 104 deletions

12
un.v
View file

@ -176,7 +176,7 @@ fn cmd_session(list bool, kill string, shell string, network string, vcpu int, t
println(exec_curl(cmd))
}
fn cmd_service(name string, ports string, bootstrap string, list bool, info string, logs string, tail string, sleep string, wake string, destroy string, network string, vcpu int, api_key string) {
fn cmd_service(name string, ports string, service_type string, bootstrap string, list bool, info string, logs string, tail string, sleep string, wake string, destroy string, network string, vcpu int, api_key string) {
if list {
cmd := "curl -s -X GET '${api_base}/services' -H 'Authorization: Bearer ${api_key}'"
println(exec_curl(cmd))
@ -227,6 +227,9 @@ fn cmd_service(name string, ports string, bootstrap string, list bool, info stri
if ports != '' {
json += ',"ports":[${ports}]'
}
if service_type != '' {
json += ',"service_type":"${service_type}"'
}
if bootstrap != '' {
if os.exists(bootstrap) {
boot_code := os.read_file(bootstrap) or { bootstrap }
@ -310,6 +313,7 @@ fn main() {
if os.args[1] == 'service' {
mut name := ''
mut ports := ''
mut service_type := ''
mut bootstrap := ''
mut list := false
mut info := ''
@ -332,6 +336,10 @@ fn main() {
i++
ports = os.args[i]
}
'--type' {
i++
service_type = os.args[i]
}
'--bootstrap' {
i++
bootstrap = os.args[i]
@ -378,7 +386,7 @@ fn main() {
i++
}
cmd_service(name, ports, bootstrap, list, info, logs, tail, sleep, wake, destroy, network,
cmd_service(name, ports, service_type, bootstrap, list, info, logs, tail, sleep, wake, destroy, network,
vcpu, api_key)
return
}