mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 04:39:19 +02:00
parent
800b3bd3fe
commit
9ad26fa049
|
@ -58,7 +58,7 @@ type Handler struct {
|
|||
downlinkCounter stats.Counter
|
||||
}
|
||||
|
||||
// NewHandler create a new Handler based on the given configuration.
|
||||
// NewHandler creates a new Handler based on the given configuration.
|
||||
func NewHandler(ctx context.Context, config *core.OutboundHandlerConfig) (outbound.Handler, error) {
|
||||
v := core.MustFromContext(ctx)
|
||||
uplinkCounter, downlinkCounter := getStatCounter(v, config.Tag)
|
||||
|
|
|
@ -122,7 +122,7 @@ func (*Router) Close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
// Type implement common.HasType.
|
||||
// Type implements common.HasType.
|
||||
func (*Router) Type() interface{} {
|
||||
return routing.RouterType()
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
const replayFilterCapacity = 100000
|
||||
|
||||
// ReplayFilter check for replay attacks.
|
||||
// ReplayFilter checks for replay attacks.
|
||||
type ReplayFilter struct {
|
||||
lock sync.Mutex
|
||||
poolA *cuckoo.Filter
|
||||
|
@ -31,7 +31,7 @@ func (filter *ReplayFilter) Interval() int64 {
|
|||
return filter.interval
|
||||
}
|
||||
|
||||
// Check determine if there are duplicate records.
|
||||
// Check determines if there are duplicate records.
|
||||
func (filter *ReplayFilter) Check(sum []byte) bool {
|
||||
filter.lock.Lock()
|
||||
defer filter.lock.Unlock()
|
||||
|
|
|
@ -53,7 +53,7 @@ func MergeBytes(dest MultiBuffer, src []byte) MultiBuffer {
|
|||
return dest
|
||||
}
|
||||
|
||||
// ReleaseMulti release all content of the MultiBuffer, and returns an empty MultiBuffer.
|
||||
// ReleaseMulti releases all content of the MultiBuffer, and returns an empty MultiBuffer.
|
||||
func ReleaseMulti(mb MultiBuffer) MultiBuffer {
|
||||
for i := range mb {
|
||||
mb[i].Release()
|
||||
|
@ -235,7 +235,7 @@ func (mb MultiBuffer) Len() int32 {
|
|||
return size
|
||||
}
|
||||
|
||||
// IsEmpty return true if the MultiBuffer has no content.
|
||||
// IsEmpty returns true if the MultiBuffer has no content.
|
||||
func (mb MultiBuffer) IsEmpty() bool {
|
||||
for _, b := range mb {
|
||||
if !b.IsEmpty() {
|
||||
|
@ -283,14 +283,14 @@ func (c *MultiBufferContainer) Write(b []byte) (int, error) {
|
|||
return len(b), nil
|
||||
}
|
||||
|
||||
// WriteMultiBuffer implement Writer.
|
||||
// WriteMultiBuffer implements Writer.
|
||||
func (c *MultiBufferContainer) WriteMultiBuffer(b MultiBuffer) error {
|
||||
mb, _ := MergeMulti(c.MultiBuffer, b)
|
||||
c.MultiBuffer = mb
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close implement io.Closer.
|
||||
// Close implements io.Closer.
|
||||
func (c *MultiBufferContainer) Close() error {
|
||||
c.MultiBuffer = ReleaseMulti(c.MultiBuffer)
|
||||
return nil
|
||||
|
|
|
@ -26,7 +26,7 @@ type lruElement struct {
|
|||
value interface{}
|
||||
}
|
||||
|
||||
// NewLru init a lru cache
|
||||
// NewLru initializes a lru cache
|
||||
func NewLru(cap int) Lru {
|
||||
return &lru{
|
||||
capacity: cap,
|
||||
|
|
|
@ -34,7 +34,7 @@ func Record(msg Message) {
|
|||
|
||||
var logHandler syncHandler
|
||||
|
||||
// RegisterHandler register a new handler as current log handler. Previous registered handler will be discarded.
|
||||
// RegisterHandler registers a new handler as current log handler. Previous registered handler will be discarded.
|
||||
func RegisterHandler(handler Handler) {
|
||||
if handler == nil {
|
||||
panic("Log handler is nil")
|
||||
|
|
|
@ -22,7 +22,7 @@ func GetToolLocation(file string) string {
|
|||
return filepath.Join(toolPath, file)
|
||||
}
|
||||
|
||||
// GetAssetLocation search for `file` in certain locations
|
||||
// GetAssetLocation searches for `file` in certain locations
|
||||
func GetAssetLocation(file string) string {
|
||||
const name = "xray.location.asset"
|
||||
assetPath := NewEnvFlag(name).GetValue(getExecutableDir)
|
||||
|
|
|
@ -20,7 +20,7 @@ func GetToolLocation(file string) string {
|
|||
return filepath.Join(toolPath, file+".exe")
|
||||
}
|
||||
|
||||
// GetAssetLocation search for `file` in the excutable dir
|
||||
// GetAssetLocation searches for `file` in the excutable dir
|
||||
func GetAssetLocation(file string) string {
|
||||
const name = "xray.location.asset"
|
||||
assetPath := NewEnvFlag(name).GetValue(getExecutableDir)
|
||||
|
|
|
@ -22,7 +22,7 @@ func ParseXForwardedFor(header http.Header) []net.Address {
|
|||
return addrs
|
||||
}
|
||||
|
||||
// RemoveHopByHopHeaders remove hop by hop headers in http header list.
|
||||
// RemoveHopByHopHeaders removes hop by hop headers in http header list.
|
||||
func RemoveHopByHopHeaders(header http.Header) {
|
||||
// Strip hop-by-hop header based on RFC:
|
||||
// http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.1
|
||||
|
|
|
@ -17,7 +17,7 @@ type pkcs8 struct {
|
|||
Version int
|
||||
Algo pkix.AlgorithmIdentifier
|
||||
PrivateKey []byte
|
||||
// optional attributes omitted.
|
||||
// Optional attributes omitted.
|
||||
}
|
||||
|
||||
type pkcs1AdditionalRSAPrime struct {
|
||||
|
|
Loading…
Reference in New Issue