chore: reduce string split immediately after string concat #773
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.
metadata.RemoteAddress()
is implemented withnet.JoinHostPort
:https://github.com/MetaCubeX/Clash.Meta/blob/fdd327d58da49b0bf21b0908bc7e3d475eae63a3/constant/metadata.go#L154-L157
However, most use cases of
RemoteAddress()
is passing it toM.ParseSocksaddr
, which is implemented withnet.SplitHostPort
https://github.com/MetaCubeX/sing/blob/f9766a597f7dbd6919a9b60c1eb1e41221e3ab1d/common/metadata/addr.go#L186-L195
Those redundant string concatenations can be ruled out by making use of
M.ParseSocksaddrHostPort
.