|
@@ -4,27 +4,28 @@ import (
|
|
"sync"
|
|
"sync"
|
|
|
|
|
|
"github.com/sagernet/sing-box/experimental/deprecated"
|
|
"github.com/sagernet/sing-box/experimental/deprecated"
|
|
|
|
+ "github.com/sagernet/sing/common"
|
|
)
|
|
)
|
|
|
|
|
|
var _ deprecated.Manager = (*deprecatedManager)(nil)
|
|
var _ deprecated.Manager = (*deprecatedManager)(nil)
|
|
|
|
|
|
type deprecatedManager struct {
|
|
type deprecatedManager struct {
|
|
- access sync.Mutex
|
|
|
|
- features []deprecated.Note
|
|
|
|
|
|
+ access sync.Mutex
|
|
|
|
+ notes []deprecated.Note
|
|
}
|
|
}
|
|
|
|
|
|
func (m *deprecatedManager) ReportDeprecated(feature deprecated.Note) {
|
|
func (m *deprecatedManager) ReportDeprecated(feature deprecated.Note) {
|
|
m.access.Lock()
|
|
m.access.Lock()
|
|
defer m.access.Unlock()
|
|
defer m.access.Unlock()
|
|
- m.features = append(m.features, feature)
|
|
|
|
|
|
+ m.notes = common.Uniq(append(m.notes, feature))
|
|
}
|
|
}
|
|
|
|
|
|
func (m *deprecatedManager) Get() []deprecated.Note {
|
|
func (m *deprecatedManager) Get() []deprecated.Note {
|
|
m.access.Lock()
|
|
m.access.Lock()
|
|
defer m.access.Unlock()
|
|
defer m.access.Unlock()
|
|
- features := m.features
|
|
|
|
- m.features = nil
|
|
|
|
- return features
|
|
|
|
|
|
+ notes := m.notes
|
|
|
|
+ m.notes = nil
|
|
|
|
+ return notes
|
|
}
|
|
}
|
|
|
|
|
|
var _ = deprecated.Note(DeprecatedNote{})
|
|
var _ = deprecated.Note(DeprecatedNote{})
|