1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-15 16:56:08 -05:00
v2fly/common/common.go

28 lines
724 B
Go
Raw Normal View History

2016-02-03 16:54:02 -05:00
// Package common contains common utilities that are shared among other packages.
// See each sub-package for detail.
package common
2016-03-09 18:33:01 -05:00
import (
2016-12-09 07:17:34 -05:00
"errors"
2016-03-09 18:33:01 -05:00
)
var (
2016-06-22 09:12:57 -04:00
ErrObjectReleased = errors.New("Object already released.")
ErrBadConfiguration = errors.New("Bad configuration.")
2016-08-18 02:34:21 -04:00
ErrObjectNotFound = errors.New("Object not found.")
ErrDuplicatedName = errors.New("Duplicated name.")
2016-03-09 18:33:01 -05:00
)
2016-03-11 17:51:58 -05:00
// Releasable interface is for those types that can release its members.
2016-03-09 18:33:01 -05:00
type Releasable interface {
2016-03-11 17:51:58 -05:00
// Release releases all references to accelerate garbage collection.
2016-03-09 18:33:01 -05:00
Release()
}
2016-12-27 15:06:55 -05:00
// Release tries to release the given object.
func Release(v interface{}) {
if releasable, ok := v.(Releasable); ok {
releasable.Release()
}
}