fix(ccm,ocm): allow reverse connector credentials to serve local requests

Connector mode credentials were unconditionally blocked from local use
by unavailableError(), despite having a working forwardHTTPClient. Also
set credentialDialer in OCM connector mode to prevent nil panic in
WebSocket handler.
This commit is contained in:
世界
2026-03-28 18:46:10 +08:00
parent 471c9c3b47
commit bf9e390cf4
2 changed files with 1 additions and 6 deletions

View File

@@ -372,9 +372,6 @@ func (c *externalCredential) earliestReset() time.Time {
}
func (c *externalCredential) unavailableError() error {
if c.reverse && c.connectorURL != nil {
return E.New("credential ", c.tag, " is unavailable: reverse connector credentials cannot serve local requests")
}
if c.baseURL == reverseProxyBaseURL {
session := c.getReverseSession()
if session == nil || session.IsClosed() {

View File

@@ -197,6 +197,7 @@ func newExternalCredential(ctx context.Context, tag string, options option.OCMEx
if options.Reverse {
// Connector mode: we dial out to serve, not to proxy
credential.credentialDialer = credentialDialer
credential.connectorDialer = credentialDialer
if options.Server != "" {
credential.connectorDestination = M.ParseSocksaddrHostPort(options.Server, externalCredentialServerPort(parsedURL, options.ServerPort))
@@ -407,9 +408,6 @@ func (c *externalCredential) earliestReset() time.Time {
}
func (c *externalCredential) unavailableError() error {
if c.reverse && c.connectorURL != nil {
return E.New("credential ", c.tag, " is unavailable: reverse connector credentials cannot serve local requests")
}
if c.baseURL == reverseProxyBaseURL {
session := c.getReverseSession()
if session == nil || session.IsClosed() {