Files
upstream-centrifugo/internal/proxy/transform.go
upstream-mirror b352a9a30d
Some checks failed
test / Lint (push) Failing after 3s
test / Test with Go 1.26.8 (push) Failing after 2s
snapshot of https://github.com/centrifugal/centrifugo.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:17:21 +05:00

95 lines
3.5 KiB
Go

package proxy
import (
"github.com/centrifugal/centrifugo/v6/internal/configtypes"
"github.com/centrifugal/centrifugo/v6/internal/proxyproto"
)
func transformConnectResponse(err error, statusToCodeTransforms configtypes.HttpStatusToCodeTransforms) (*proxyproto.ConnectResponse, error) {
protocolError, protocolDisconnect := transformHTTPStatusError(err, statusToCodeTransforms)
if protocolError != nil || protocolDisconnect != nil {
return &proxyproto.ConnectResponse{
Error: protocolError,
Disconnect: protocolDisconnect,
}, nil
}
return nil, err
}
func transformPublishResponse(err error, statusToCodeTransforms configtypes.HttpStatusToCodeTransforms) (*proxyproto.PublishResponse, error) {
protocolError, protocolDisconnect := transformHTTPStatusError(err, statusToCodeTransforms)
if protocolError != nil || protocolDisconnect != nil {
return &proxyproto.PublishResponse{
Error: protocolError,
Disconnect: protocolDisconnect,
}, nil
}
return nil, err
}
func transformSubscribeResponse(err error, statusToCodeTransforms configtypes.HttpStatusToCodeTransforms) (*proxyproto.SubscribeResponse, error) {
protocolError, protocolDisconnect := transformHTTPStatusError(err, statusToCodeTransforms)
if protocolError != nil || protocolDisconnect != nil {
return &proxyproto.SubscribeResponse{
Error: protocolError,
Disconnect: protocolDisconnect,
}, nil
}
return nil, err
}
func transformRPCResponse(err error, statusToCodeTransforms configtypes.HttpStatusToCodeTransforms) (*proxyproto.RPCResponse, error) {
protocolError, protocolDisconnect := transformHTTPStatusError(err, statusToCodeTransforms)
if protocolError != nil || protocolDisconnect != nil {
return &proxyproto.RPCResponse{
Error: protocolError,
Disconnect: protocolDisconnect,
}, nil
}
return nil, err
}
func transformSubRefreshResponse(err error, statusToCodeTransforms configtypes.HttpStatusToCodeTransforms) (*proxyproto.SubRefreshResponse, error) {
protocolError, protocolDisconnect := transformHTTPStatusError(err, statusToCodeTransforms)
if protocolError != nil || protocolDisconnect != nil {
return &proxyproto.SubRefreshResponse{
Error: protocolError,
Disconnect: protocolDisconnect,
}, nil
}
return nil, err
}
func transformRefreshResponse(err error, statusToCodeTransforms configtypes.HttpStatusToCodeTransforms) (*proxyproto.RefreshResponse, error) {
protocolError, protocolDisconnect := transformHTTPStatusError(err, statusToCodeTransforms)
if protocolError != nil || protocolDisconnect != nil {
return &proxyproto.RefreshResponse{
Error: protocolError,
Disconnect: protocolDisconnect,
}, nil
}
return nil, err
}
func transformMapPublishResponse(err error, statusToCodeTransforms configtypes.HttpStatusToCodeTransforms) (*proxyproto.MapPublishResponse, error) {
protocolError, protocolDisconnect := transformHTTPStatusError(err, statusToCodeTransforms)
if protocolError != nil || protocolDisconnect != nil {
return &proxyproto.MapPublishResponse{
Error: protocolError,
Disconnect: protocolDisconnect,
}, nil
}
return nil, err
}
func transformMapRemoveResponse(err error, statusToCodeTransforms configtypes.HttpStatusToCodeTransforms) (*proxyproto.MapRemoveResponse, error) {
protocolError, protocolDisconnect := transformHTTPStatusError(err, statusToCodeTransforms)
if protocolError != nil || protocolDisconnect != nil {
return &proxyproto.MapRemoveResponse{
Error: protocolError,
Disconnect: protocolDisconnect,
}, nil
}
return nil, err
}