Skip to content

fix: convert anytls padding_scheme array to string for node compatibility#811

Open
onesyue wants to merge 1 commit intocedar2025:masterfrom
onesyue:fix/anytls-padding-scheme-type
Open

fix: convert anytls padding_scheme array to string for node compatibility#811
onesyue wants to merge 1 commit intocedar2025:masterfrom
onesyue:fix/anytls-padding-scheme-type

Conversation

@onesyue
Copy link

@onesyue onesyue commented Mar 17, 2026

Summary

  • buildNodeConfig() sends padding_scheme as a PHP array, which serializes to a JSON array (["stop=8","0=30-30",...])
  • xboard-node (Go) declares padding_scheme as panel.StringOrArray, but mapstructure cannot decode []interface{} into this custom type
  • This causes all anytls nodes to fail with: 'padding_scheme' expected type 'panel.StringOrArray', got unconvertible type '[]interface {}'
  • Nodes cannot load config → zero users on anytls

Fix

Convert the array to a \n-delimited string before returning to the node. StringOrArray handles plain strings correctly.

// Before
'padding_scheme' => $protocolSettings['padding_scheme'],

// After  
'padding_scheme' => is_array($protocolSettings['padding_scheme'])
    ? implode("\n", $protocolSettings['padding_scheme'])
    : ($protocolSettings['padding_scheme'] ?? ''),

Test plan

  • Verified on 39 production nodes — all anytls nodes recovered from zero users
  • No padding_scheme decode errors in node logs after fix
  • Nodes with explicit padding_scheme in DB and nodes using the default both work correctly

🤖 Generated with Claude Code

…lity

The panel stores padding_scheme as a PHP array in PROTOCOL_CONFIGURATIONS
and always injects it into the API response via buildNodeConfig(). However,
xboard-node (Go) expects padding_scheme as type `panel.StringOrArray`, and
mapstructure cannot decode `[]interface{}` (JSON array) into this custom type,
causing "poll config failed" errors on all anytls nodes.

Convert the array to a newline-delimited string before sending to the node,
which StringOrArray can correctly parse.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant