|
@@ -128,33 +128,37 @@ _get_dns_records_os :: proc(hostname: string, type: DNS_Record_Type, allocator :
|
|
append(&recs, record)
|
|
append(&recs, record)
|
|
|
|
|
|
case .SRV:
|
|
case .SRV:
|
|
- target := strings.clone(string(r.Data.SRV.pNameTarget)) // The target hostname/address that the service can be found on
|
|
|
|
- priority := int(r.Data.SRV.wPriority)
|
|
|
|
- weight := int(r.Data.SRV.wWeight)
|
|
|
|
- port := int(r.Data.SRV.wPort)
|
|
|
|
-
|
|
|
|
// NOTE(tetra): Srv record name should be of the form '_servicename._protocol.hostname'
|
|
// NOTE(tetra): Srv record name should be of the form '_servicename._protocol.hostname'
|
|
// The record name is the name of the record.
|
|
// The record name is the name of the record.
|
|
// Not to be confused with the _target_ of the record, which is--in combination with the port--what we're looking up
|
|
// Not to be confused with the _target_ of the record, which is--in combination with the port--what we're looking up
|
|
// by making this request in the first place.
|
|
// by making this request in the first place.
|
|
|
|
|
|
- // NOTE(Jeroen): Service Name and Protocol Name can probably just be string slices into the record name.
|
|
|
|
- // It's already cloned, after all. I wouldn't put them on the temp allocator like this.
|
|
|
|
|
|
+ service_name, protocol_name: string
|
|
|
|
+
|
|
|
|
+ s := base_record.record_name
|
|
|
|
+ i := strings.index_byte(s, '.')
|
|
|
|
+ if i > -1 {
|
|
|
|
+ service_name = s[:i]
|
|
|
|
+ s = s[len(service_name) + 1:]
|
|
|
|
+ } else {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
|
|
- parts := strings.split_n(base_record.record_name, ".", 3, context.temp_allocator)
|
|
|
|
- if len(parts) != 3 {
|
|
|
|
|
|
+ i = strings.index_byte(s, '.')
|
|
|
|
+ if i > -1 {
|
|
|
|
+ protocol_name = s[:i]
|
|
|
|
+ } else {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
- service_name, protocol_name := parts[0], parts[1]
|
|
|
|
|
|
|
|
append(&recs, DNS_Record_SRV {
|
|
append(&recs, DNS_Record_SRV {
|
|
base = base_record,
|
|
base = base_record,
|
|
- target = target,
|
|
|
|
- port = port,
|
|
|
|
|
|
+ target = strings.clone(string(r.Data.SRV.pNameTarget)), // The target hostname/address that the service can be found on
|
|
|
|
+ port = int(r.Data.SRV.wPort),
|
|
service_name = service_name,
|
|
service_name = service_name,
|
|
protocol_name = protocol_name,
|
|
protocol_name = protocol_name,
|
|
- priority = priority,
|
|
|
|
- weight = weight,
|
|
|
|
|
|
+ priority = int(r.Data.SRV.wPriority),
|
|
|
|
+ weight = int(r.Data.SRV.wWeight),
|
|
|
|
|
|
})
|
|
})
|
|
}
|
|
}
|