mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-13 05:44:12 +08:00
add service.Subscription
This commit is contained in:
parent
356ee6f8fa
commit
c1eb9e807a
@ -1,8 +1,9 @@
|
||||
package option
|
||||
|
||||
type SubscriptionServiceOptions struct {
|
||||
Interval Duration `json:"interval,omitempty"`
|
||||
Providers []SubscriptionProviderOptions `json:"providers"`
|
||||
Interval Duration `json:"interval,omitempty"`
|
||||
DownloadDetour string `json:"download_detour,omitempty"`
|
||||
Providers []SubscriptionProviderOptions `json:"providers"`
|
||||
|
||||
DialerOptions
|
||||
}
|
||||
|
21
service/default.go
Normal file
21
service/default.go
Normal file
@ -0,0 +1,21 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
"github.com/sagernet/sing-box/log"
|
||||
)
|
||||
|
||||
type myServiceAdapter struct {
|
||||
serviceType string
|
||||
router adapter.Router
|
||||
logger log.ContextLogger
|
||||
tag string
|
||||
}
|
||||
|
||||
func (a *myServiceAdapter) Type() string {
|
||||
return a.serviceType
|
||||
}
|
||||
|
||||
func (a *myServiceAdapter) Tag() string {
|
||||
return a.tag
|
||||
}
|
@ -2,10 +2,33 @@ package service
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
"github.com/sagernet/sing-box/log"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
)
|
||||
|
||||
func NewSubscription(router adapter.Router, logger log.ContextLogger, options option.Service) (adapter.BoxService, error) {
|
||||
panic("not implemented")
|
||||
var _ adapter.BoxService = (*Subscription)(nil)
|
||||
|
||||
// Subscription is a service that subscribes to remote servers for outbounds.
|
||||
type Subscription struct {
|
||||
myServiceAdapter
|
||||
}
|
||||
|
||||
func NewSubscription(router adapter.Router, logger log.ContextLogger, options option.Service) (*Subscription, error) {
|
||||
return &Subscription{
|
||||
myServiceAdapter{
|
||||
router: router,
|
||||
serviceType: C.ServiceSubscription,
|
||||
logger: logger,
|
||||
tag: options.Tag,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Subscription) Start() error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (s *Subscription) Close() error {
|
||||
panic("implement me")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user