mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-16 15:26:40 +00:00
CLI: new expose command to publish a local port with flags for PIN, password, user groups, custom domain, name prefix and protocol (HTTP default). Management/API: create/renew/stop expose sessions (streamed status), automatic naming/domain, TTL renewals, background expiration, new management RPCs and client methods. UI/API: account settings now include peer_expose_enabled and peer_expose_groups; new activity codes for peer expose events.
40 lines
1012 B
Go
40 lines
1012 B
Go
package expose
|
|
|
|
import (
|
|
daemonProto "github.com/netbirdio/netbird/client/proto"
|
|
mgm "github.com/netbirdio/netbird/shared/management/client"
|
|
)
|
|
|
|
// NewRequest converts a daemon ExposeServiceRequest to a management ExposeServiceRequest.
|
|
func NewRequest(req *daemonProto.ExposeServiceRequest) *Request {
|
|
return &Request{
|
|
Port: uint16(req.Port),
|
|
Protocol: int(req.Protocol),
|
|
Pin: req.Pin,
|
|
Password: req.Password,
|
|
UserGroups: req.UserGroups,
|
|
Domain: req.Domain,
|
|
NamePrefix: req.NamePrefix,
|
|
}
|
|
}
|
|
|
|
func toClientExposeRequest(req Request) mgm.ExposeRequest {
|
|
return mgm.ExposeRequest{
|
|
NamePrefix: req.NamePrefix,
|
|
Domain: req.Domain,
|
|
Port: req.Port,
|
|
Protocol: req.Protocol,
|
|
Pin: req.Pin,
|
|
Password: req.Password,
|
|
UserGroups: req.UserGroups,
|
|
}
|
|
}
|
|
|
|
func fromClientExposeResponse(response *mgm.ExposeResponse) *Response {
|
|
return &Response{
|
|
ServiceName: response.ServiceName,
|
|
Domain: response.Domain,
|
|
ServiceURL: response.ServiceURL,
|
|
}
|
|
}
|