mirror of
https://github.com/SagerNet/sing-box.git
synced 2025-06-13 21:54:13 +08:00
add service.Subscription
This commit is contained in:
parent
356ee6f8fa
commit
c1eb9e807a
@ -2,6 +2,7 @@ package option
|
|||||||
|
|
||||||
type SubscriptionServiceOptions struct {
|
type SubscriptionServiceOptions struct {
|
||||||
Interval Duration `json:"interval,omitempty"`
|
Interval Duration `json:"interval,omitempty"`
|
||||||
|
DownloadDetour string `json:"download_detour,omitempty"`
|
||||||
Providers []SubscriptionProviderOptions `json:"providers"`
|
Providers []SubscriptionProviderOptions `json:"providers"`
|
||||||
|
|
||||||
DialerOptions
|
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 (
|
import (
|
||||||
"github.com/sagernet/sing-box/adapter"
|
"github.com/sagernet/sing-box/adapter"
|
||||||
|
C "github.com/sagernet/sing-box/constant"
|
||||||
"github.com/sagernet/sing-box/log"
|
"github.com/sagernet/sing-box/log"
|
||||||
"github.com/sagernet/sing-box/option"
|
"github.com/sagernet/sing-box/option"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewSubscription(router adapter.Router, logger log.ContextLogger, options option.Service) (adapter.BoxService, error) {
|
var _ adapter.BoxService = (*Subscription)(nil)
|
||||||
panic("not implemented")
|
|
||||||
|
// 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