Skip to content

Improve API instance support#3643

Merged
xiaokangwang merged 2 commits intov2fly:masterfrom
xiaokangwang:dev-api-instance-improve-jmsbbjrdy222xp2vtqd6xu27xpatirzy7kez
Mar 10, 2026
Merged

Improve API instance support#3643
xiaokangwang merged 2 commits intov2fly:masterfrom
xiaokangwang:dev-api-instance-improve-jmsbbjrdy222xp2vtqd6xu27xpatirzy7kez

Conversation

@xiaokangwang
Copy link
Copy Markdown
Contributor

(Machine Generated Summary)
This pull request introduces improvements to the startup process for the v2binding package, focusing on better handling of configuration files and instance initialization. The changes add support for setting a base directory, loading a default configuration if present, and improving error reporting. Additionally, the API instance is now bound to the local host for increased security.

Configuration and startup enhancements:

  • Added a baseDir field to the bindingInstance struct and implemented the setBaseDir method to set the working directory and create an attention file for configuration placement. [1] [2]
  • Introduced the loadDefaultConfigIfExists method to automatically load and start a default instance from config.json if it exists in the base directory. [1] [2]
  • Updated the startup sequence in StartAPIInstance to set the base directory and attempt to load the default configuration, logging errors to last_err.txt if loading fails.

Security improvement:

  • Changed the API instance listener from net.AnyIP to net.LocalHostIP, restricting access to localhost only.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2026

Codecov Report

❌ Patch coverage is 0% with 32 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.96%. Comparing base (5265692) to head (21b72b7).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
main/v2binding/startUp.go 0.00% 26 Missing ⚠️
main/v2binding/v2binding.go 0.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3643      +/-   ##
==========================================
- Coverage   23.29%   22.96%   -0.33%     
==========================================
  Files         857      864       +7     
  Lines       46766    47468     +702     
==========================================
+ Hits        10893    10900       +7     
- Misses      34615    35311     +696     
+ Partials     1258     1257       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@xiaokangwang xiaokangwang merged commit 66c2586 into v2fly:master Mar 10, 2026
39 of 42 checks passed
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.

1 participant