Remnawave_migrate/source/source.go
Sergey Kutovoy faf2786d01
Refactor: Implement universal panel migration architecture
- Created modular source panel interface for extensibility
- Renamed arguments from marzban-* to panel-*
- Added panel-type argument with support for "marzban" and "marzneshin"
- Implemented Marzneshin panel support with unique proxy extraction logic
- Restructured models to support different panel types
- Updated README with new options and instructions
- Renamed app to "remnawave-migrate" to reflect universal nature

This refactoring makes the migration tool more flexible and
allows easier addition of new panel types in the future.

Co-authored-by: Yury Kastov <kastov@gog.sh>
2025-03-17 00:48:02 +05:00

24 lines
479 B
Go

package source
import (
"fmt"
"remnawave-migrate/models"
)
type SourcePanel interface {
Login(username, password string) error
GetUsers(offset, limit int) (*models.UsersResponse, error)
}
func Factory(panelType, baseURL string) (SourcePanel, error) {
switch panelType {
case "marzban":
return NewMarzbanPanel(baseURL), nil
case "marzneshin":
return NewMarzneshinPanel(baseURL), nil
default:
return nil, fmt.Errorf("unsupported panel type: %s", panelType)
}
}