mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-25 22:56:04 +03:00
Restrict tag to be unique (#258)
This commit is contained in:
parent
fed8610d3f
commit
9aa49be703
@ -42,6 +42,9 @@ func (m *Manager) AddHandler(ctx context.Context, handler inbound.Handler) error
|
|||||||
|
|
||||||
tag := handler.Tag()
|
tag := handler.Tag()
|
||||||
if len(tag) > 0 {
|
if len(tag) > 0 {
|
||||||
|
if _, found := m.taggedHandlers[tag]; found {
|
||||||
|
return newError("existing tag found: " + tag)
|
||||||
|
}
|
||||||
m.taggedHandlers[tag] = handler
|
m.taggedHandlers[tag] = handler
|
||||||
} else {
|
} else {
|
||||||
m.untaggedHandler = append(m.untaggedHandler, handler)
|
m.untaggedHandler = append(m.untaggedHandler, handler)
|
||||||
|
@ -109,6 +109,9 @@ func (m *Manager) AddHandler(ctx context.Context, handler outbound.Handler) erro
|
|||||||
|
|
||||||
tag := handler.Tag()
|
tag := handler.Tag()
|
||||||
if len(tag) > 0 {
|
if len(tag) > 0 {
|
||||||
|
if _, found := m.taggedHandler[tag]; found {
|
||||||
|
return newError("existing tag found: " + tag)
|
||||||
|
}
|
||||||
m.taggedHandler[tag] = handler
|
m.taggedHandler[tag] = handler
|
||||||
} else {
|
} else {
|
||||||
m.untaggedHandlers = append(m.untaggedHandlers, handler)
|
m.untaggedHandlers = append(m.untaggedHandlers, handler)
|
||||||
|
Loading…
Reference in New Issue
Block a user