gitee.com/zhongguo168a/gocodes@v0.0.0-20230609140523-e1828349603f/gox/netx/约定端口.go (about)

     1  package netx
     2  
     3  import (
     4  	"strconv"
     5  )
     6  
     7  // 同一台机器未了避免端口冲突,约定规则
     8  // 10000 +  渠道 % 100 * 1000 + 物理服务器% 10 * 100 + 用途 (1-99)
     9  func Y约定端口(addr string, channel, physerver int, use int) string {
    10  	return addr + ":" + strconv.Itoa(10000+1000*(channel%10)+100*(physerver%10)+use)
    11  }