mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-05-21 20:06:20 +03:00
mitm: Refactor & Add url
This commit is contained in:
32
script/modules/surge/script.go
Normal file
32
script/modules/surge/script.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package surge
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/script/jsc"
|
||||
"github.com/sagernet/sing-box/script/modules/boxctx"
|
||||
F "github.com/sagernet/sing/common/format"
|
||||
)
|
||||
|
||||
type Script struct {
|
||||
class jsc.Class[*Module, *Script]
|
||||
ScriptType string
|
||||
}
|
||||
|
||||
func createScript(module *Module) jsc.Class[*Module, *Script] {
|
||||
class := jsc.NewClass[*Module, *Script](module)
|
||||
class.DefineField("name", (*Script).getName, nil)
|
||||
class.DefineField("type", (*Script).getType, nil)
|
||||
class.DefineField("startTime", (*Script).getStartTime, nil)
|
||||
return class
|
||||
}
|
||||
|
||||
func (s *Script) getName() any {
|
||||
return F.ToString("script:", boxctx.MustFromRuntime(s.class.Runtime()).Tag)
|
||||
}
|
||||
|
||||
func (s *Script) getType() any {
|
||||
return s.ScriptType
|
||||
}
|
||||
|
||||
func (s *Script) getStartTime() any {
|
||||
return boxctx.MustFromRuntime(s.class.Runtime()).StartedAt
|
||||
}
|
||||
Reference in New Issue
Block a user