Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

feat(balancer) option to return nested SRV name as hostname #89

Merged
merged 3 commits into from
May 14, 2020
Merged

Conversation

Tieske
Copy link
Member

@Tieske Tieske commented May 1, 2020

This enables the balancer to return a host-header.

So far the returned "host" was always the name of the host as it was added to the balancer by calling addHost(). With this PR there is a change between the Host as added and the host-header to be used on a request.

  • getPeer() will return the host-header instead of the name. The breaking change here is that if the name as added is an IP address, then the host-header returned will be nil. Otherwise, with all defaults everything will be the same.
  • the balancer gets a new option useSRVname (false by default), which if set, will instruct the returned Host-header to be the name inside an SRV record. If not and SRV record, then it will return the hostname as added to the balancer (as before).
  • the callback for adding/removing addresses gets an extra argument; the host-header (because it is additional it will get the hostname, as well as the host-header)

@Tieske Tieske marked this pull request as draft May 1, 2020 10:25
@Tieske Tieske force-pushed the srv-name branch 3 times, most recently from 0091920 to d47b994 Compare May 1, 2020 11:38
…hostname

BREAKING: mostly the effect is the since `useSRVname` hasn't been released
yet. The breaking part is that in case an IP address is added through
`addHost`, the returned hostname by `getPeer` will now be `nil` where
it previously was the IP address.

Semantically the return value changed from the 'host' to the 'host-header'
but as stated; changes only if it was an IP address to begin with.
@Tieske Tieske marked this pull request as ready for review May 3, 2020 14:20
@Tieske Tieske self-assigned this May 3, 2020
@Tieske Tieske requested a review from locao May 3, 2020 14:20
@locao locao merged commit c9cc547 into master May 14, 2020
@locao locao deleted the srv-name branch May 14, 2020 14:36
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants