kafka-go
kafka-go copied to clipboard
Allow the resolver to override the port setting
The custom resolver couldn't override the default port even if id had been explicitly provided. The reason for that is unclear as it contradicts the open closed principle. Why: Common address resolvers should alway only return the host. If a port is being provided this has been intended.
Purpose of this Patch: Access a kafka cluster behind a firewall via portforwarding on a jump host. jumphost: 9095 -> kafkahost1:9092, jumphost: 9096 -> kafkahost2:9092, ...
Port overrides seem to have been prevented due to the default ports being provided. The test had to be adapted but seemed a bit akward to me. Prior: example.com:9092 -> 127.0.0.1:80 resulted in 127.0.0.1:9092 (why?) Now: example.com:9092 -> 127.0.0.1:80 results in 127.0.0.1:80
Hello @themulle, thanks for submitting this pull request.
I left a question about the implementation, let me know what you think!
finally a good solution after digging into net/ip.go to understand the behaviour of net.SplitHostPort
hi, this commit hasn't been merged into the main branch yet(I have the same problem)
Hello @chris-wangkk
The original author appears to have abandoned the pull request. There were a few comments left that haven't been addressed.
Would you be available to take over and complete this work?