Implemented dynamic domain support #294
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What is this
Implemented dynamic domain support that also doubles as a health check endpoint for loadbalancers.
Details:
Dynamic domain support
Traditionally
conn.Domain
contains the domain that should be the server identifying itself to the connecting clients with during the initial greeting. My PR enabled this field to be dynamic: a function can be specified to generate the value for this field instead of passing theconn.Domain
value. It is backward compatible as the greeter will send the value of theconn.Domain
field if the dynamic getter function is not set. This feature is useful if a given server handles traffic for more than one endpoint.Health check support
Greeter function will reject the connection with 554 if the dynamic function returns an error. This is very intentional and is particularly useful with load-balanced setups as in this case the server has an option to tell the health-check-monitoring loadbalancer if they are incapable of receiving traffic. The
Conn.handle
was also modified to be in conform with RFC5321 regarding proper handling of rejected sessions.Checkmarks