Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send SRV records? #74

Closed
BasToTheMax opened this issue Oct 27, 2022 · 4 comments
Closed

How to send SRV records? #74

BasToTheMax opened this issue Oct 27, 2022 · 4 comments

Comments

@BasToTheMax
Copy link

No description provided.

@BasToTheMax
Copy link
Author

^

@BasToTheMax
Copy link
Author

:)

@stefanwerfling
Copy link

This is very simple :)

First look for structur: https://www.dynu.com/Resources/DNS-Records/SRV-Record

Extend DnsAnswer and add the fields, any field have a seperator:

interface DnsAnswerSRV extends DnsAnswer {
  priority: number;
  weight: number;
  port: number;
  target_host: string;
}

Now you can send:

const response = DNS.Packet.createResponseFromRequest(request);

....

response.answers.push({
name: '_sip._udp.example.com',
type: DNS.Packet.TYPE.SRV,
class: DNS.Packet.CLASS.IN,
ttl: 3600,
priority: 10,
weight: 5,
port: 5060,
target_host: 'siphost.com'
} as DnsAnswerSRV);

...

send(response);

I hope it help! I use it by my project: https://github.com/stefanwerfling/flyingfish/blob/main/backend/src/inc/Dns/Dns2Server.ts#L129

@BasToTheMax
Copy link
Author

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants