Skip to content

Conversation

@MayCXC
Copy link
Contributor

@MayCXC MayCXC commented Nov 1, 2025

Assistance Disclosure

No AI was used.

Implements #7243 with https://github.com/MayCXC/caddy-systemd-socket-activation to read LISTEN_FDS and LISTEN_PID from the environment as well, support binding port ranges to homonymous file descriptors, and reserve the datagram networks for h3.

Caddyfile syntax comparison:

  • bind fdname/name:10 -> bind sd/name/10
  • bind fdgramname/name:10 -> bind sdgram/name/10

Support for both is moved to the linux && !nosystemd target, and custom network support code is isolated in networks.go. This is also a nice way to implement iface custom networks for #7256

@MayCXC MayCXC changed the title Sd sdgram networks sd and sdgram networks for systemd.socket named file descriptors Nov 1, 2025
@francislavoie
Copy link
Member

FYI @Siomachkin

// type is standard, reserved, or already registered.
//
// EXPERIMENTAL: Subject to change.
func RegisterNetworkHTTP3(originalNetwork, h3Network string) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we leave this in and have this call caddy.RegisterNetworkHTTP3 to keep backwards compat for a while, and mark this as deprecated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah that works, I'll put it back.

@MayCXC MayCXC marked this pull request as draft November 2, 2025 11:41
@MayCXC
Copy link
Contributor Author

MayCXC commented Nov 2, 2025

drafted to evaluate a bind fd/{systemd.socket.name} placeholder as well as bind {iface.eth0}.

@francislavoie
Copy link
Member

How does the nosystemd build target work? That doesn't seem like a Go built-in, so it would mean -tags nosystemd would need to be used, right?

I don't see a problem with leaving that code compiled in for all linux builds because it requires a pretty specific combination of env vars to be set to work anyway, and throws an error that the user needs to handle otherwise.

@MayCXC
Copy link
Contributor Author

MayCXC commented Nov 4, 2025

How does the nosystemd build target work? That doesn't seem like a Go built-in, so it would mean -tags nosystemd would need to be used, right?

I don't see a problem with leaving that code compiled in for all linux builds because it requires a pretty specific combination of env vars to be set to work anyway, and throws an error that the user needs to handle otherwise.

yes, it is a tag. the best reason I can give for the target is that it smells to test this feature on osx and windows. using a negated target leaves it on by default.

that said, closed in favor of #7340

@MayCXC MayCXC closed this Nov 4, 2025
@francislavoie
Copy link
Member

Well the linux target is enough to avoid osx/windows, no need to an extra build flag IMO

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