Fix custom tls setting for tlsmirror roundtripper enrollment

This commit is contained in:
Shelikhoo
2026-01-01 20:18:54 +00:00
committed by Xiaokang Wang (Shelikhoo)
parent 9dd745f0ae
commit 393acfa847
3 changed files with 13 additions and 2 deletions
@@ -77,6 +77,9 @@ func (h *httpTripperClient) RoundTrip(ctx context.Context, req request.Request,
return resp, err
}
defer httpResp.Body.Close()
if httpResp.StatusCode != http.StatusOK {
newError("non-200 response: ", httpResp.Status).AtInfo().WriteToLog()
}
if streamingWriter == nil {
result, err := io.ReadAll(httpResp.Body)
if err != nil {
@@ -90,7 +90,11 @@ func (c *Client) Dial(ctx context.Context) (net.Conn, error) {
return nil, newError("failed to dial to destination").Base(err).AtError()
}
if c.config.SecurityConfig != nil {
securityEngine, err := common.CreateObject(c.ctx, c.config.SecurityConfig)
securityConfigSetting, err := serial.GetInstanceOf(c.config.SecurityConfig)
if err != nil {
return nil, newError("unable to get security config instance").Base(err)
}
securityEngine, err := common.CreateObject(c.ctx, securityConfigSetting)
if err != nil {
return nil, newError("unable to create security engine from security settings").Base(err)
}
@@ -99,7 +99,11 @@ func (c *ServerInverseRole) Dial(ctx context.Context) (net.Conn, error) {
return nil, newError("failed to dial to destination").Base(err).AtError()
}
if c.config.SecurityConfig != nil {
securityEngine, err := common.CreateObject(ctx, c.config.SecurityConfig)
securityConfigSetting, err := serial.GetInstanceOf(c.config.SecurityConfig)
if err != nil {
return nil, newError("unable to get security config instance").Base(err)
}
securityEngine, err := common.CreateObject(c.ctx, securityConfigSetting)
if err != nil {
return nil, newError("unable to create security engine from security settings").Base(err)
}