mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-11 17:47:20 +10:00
30 lines
573 B
Go
30 lines
573 B
Go
package daemon
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/sagernet/sing-box/experimental/deprecated"
|
|
"github.com/sagernet/sing/common"
|
|
)
|
|
|
|
var _ deprecated.Manager = (*deprecatedManager)(nil)
|
|
|
|
type deprecatedManager struct {
|
|
access sync.Mutex
|
|
notes []deprecated.Note
|
|
}
|
|
|
|
func (m *deprecatedManager) ReportDeprecated(feature deprecated.Note) {
|
|
m.access.Lock()
|
|
defer m.access.Unlock()
|
|
m.notes = common.Uniq(append(m.notes, feature))
|
|
}
|
|
|
|
func (m *deprecatedManager) Get() []deprecated.Note {
|
|
m.access.Lock()
|
|
defer m.access.Unlock()
|
|
notes := m.notes
|
|
m.notes = nil
|
|
return notes
|
|
}
|