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

chore: reduce string split immediately after string concat #773

Merged
merged 1 commit into from
Sep 29, 2023
Merged

chore: reduce string split immediately after string concat #773

merged 1 commit into from
Sep 29, 2023

Conversation

imkiva
Copy link

@imkiva imkiva commented Sep 25, 2023

metadata.RemoteAddress() is implemented with net.JoinHostPort:

https://github.com/MetaCubeX/Clash.Meta/blob/fdd327d58da49b0bf21b0908bc7e3d475eae63a3/constant/metadata.go#L154-L157

However, most use cases of RemoteAddress() is passing it to M.ParseSocksaddr, which is implemented with net.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.

@wwqgtxx wwqgtxx merged commit 265a6b9 into MetaCubeX:Alpha Sep 29, 2023
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

Successfully merging this pull request may close these issues.

2 participants