github.com/TeaOSLab/EdgeNode@v1.3.8/internal/compressions/writer_pool_brotli.go (about)

     1  // Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
     2  
     3  package compressions
     4  
     5  import (
     6  	teaconst "github.com/TeaOSLab/EdgeNode/internal/const"
     7  	"io"
     8  )
     9  
    10  var sharedBrotliWriterPool *WriterPool
    11  
    12  func init() {
    13  	if !teaconst.IsMain {
    14  		return
    15  	}
    16  
    17  	sharedBrotliWriterPool = NewWriterPool(CalculatePoolSize(), func(writer io.Writer, level int) (Writer, error) {
    18  		return newBrotliWriter(writer)
    19  	})
    20  }