Skip to content

Commit 1b0a319

Browse files
committed
refactor: move main to cmd
1 parent b95593b commit 1b0a319

6 files changed

Lines changed: 4 additions & 8 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ NAME = pasarguard-node-$(GOOS)-$(GOARCH)
22

33
LDFLAGS = -s -w -buildid=
44
PARAMS = -trimpath -ldflags "$(LDFLAGS)" -v
5-
MAIN = ./main.go
5+
MAIN = ./cmd/node
66
PREFIX ?= $(shell go env GOPATH)
77
XRAY_OS ?=
88
XRAY_ARCH ?=
@@ -172,4 +172,4 @@ test-race-wireguard:
172172
GOTOOLCHAIN=auto CGO_ENABLED=1 go test -race -v -p 1 ./backend/wireguard
173173

174174
serve:
175-
go run main.go serve
175+
go run ./cmd/node

backend/wireguard/wireguard.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ func newWithManagerFactory(cfg *config.Config, wgConfig *Config, users []*common
170170
psk, _ := wgConfig.GetPreSharedKey()
171171
startupPeerConfigs, appliedKeys := buildTargetPeerConfigs(startupDiff.TargetPeers, psk)
172172

173-
174173
manager, err := wg.newManager(wgConfig.InterfaceName)
175174
if err != nil {
176175
return nil, fmt.Errorf("failed to create manager: %w", err)

backend/xray/core_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ func setProcAttributes(cmd *exec.Cmd) {
1313
Setpgid: true,
1414
Pgid: 0,
1515
}
16-
}
16+
}

backend/xray/core_windows.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ func setProcAttributes(cmd *exec.Cmd) {
1616
// NoInheritHandles ensures child processes don't inherit handles unnecessarily
1717
NoInheritHandles: false,
1818
}
19-
}
19+
}

backend/xray/process_windows.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,4 +231,3 @@ func isProcessZombie(pid int) bool {
231231

232232
return false
233233
}
234-

main.go renamed to cmd/node/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ func main() {
4848
stopChan := make(chan os.Signal, 1)
4949
signal.Notify(stopChan, os.Interrupt, syscall.SIGTERM)
5050

51-
// Wait for interrupt
5251
<-stopChan
5352
log.Println("Shutting down server...")
5453

55-
// Graceful shutdown
5654
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
5755
defer cancel()
5856

0 commit comments

Comments
 (0)