mirror of
https://github.com/tufanbarisyildirim/gonginx.git
synced 2026-04-27 00:35:51 +03:00
[PR #78] [MERGED] Implement server helper API for lookup/listen/location management #76
Labels
No labels
bug
enhancement
good first issue
pull-request
question
v2
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/gonginx#76
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/tufanbarisyildirim/gonginx/pull/78
Author: @tufanbarisyildirim
Created: 2/20/2026
Status: ✅ Merged
Merged: 2/20/2026
Merged by: @tufanbarisyildirim
Base:
master← Head:fix/issue-47-server-helper-api📝 Commits (1)
75ffbc2Add server helper APIs for name, listen, and locations📊 Changes
5 files changed (+372 additions, -0 deletions)
View changed files
📝
GUIDE.md(+45 -0)📝
config/http.go(+17 -0)➕
config/http_test.go(+46 -0)📝
config/server.go(+139 -0)📝
config/server_test.go(+125 -0)📄 Description
Final API Decision (owner-level)
This issue requested a richer server API. To keep it practical and backward-compatible, this PR implements a method-based first step instead of introducing a new
Listenmodel right now.Implemented:
(*config.HTTP).GetServerByServerName(serverName string) *Server(*config.Server).GetLocations() []*Location(direct child locations only)(*config.Server).GetListenPorts() []int(numeric TCP ports only)(*config.Server).SetListenPort(index int, port int) errorBehavior decisions:
GetServerByServerNamereturns the first matching server (ornil)GetListenPortsignores non-port listen endpoints (for exampleunix:/...)SetListenPortpreserves listen endpoint form when possible (80,127.0.0.1:8080,[::]:443)Tests
config/http_test.goconfig/server_test.gowith listen/location helper coveragego test ./configmake testCloses #47
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.