MCPcopy Index your code
hub / github.com/coder/coder / DERPMapToProto

Function DERPMapToProto

tailnet/convert.go:143–166  ·  view source on GitHub ↗
(derpMap *tailcfg.DERPMap)

Source from the content-addressed store, hash-verified

141}
142
143func DERPMapToProto(derpMap *tailcfg.DERPMap) *proto.DERPMap {
144 if derpMap == nil {
145 return nil
146 }
147
148 regionScore := make(map[int64]float64)
149 if derpMap.HomeParams != nil {
150 for k, v := range derpMap.HomeParams.RegionScore {
151 regionScore[int64(k)] = v
152 }
153 }
154
155 regions := make(map[int64]*proto.DERPMap_Region, len(derpMap.Regions))
156 for regionID, region := range derpMap.Regions {
157 regions[int64(regionID)] = DERPRegionToProto(region)
158 }
159
160 return &proto.DERPMap{
161 HomeParams: &proto.DERPMap_HomeParams{
162 RegionScore: regionScore,
163 },
164 Regions: regions,
165 }
166}
167
168func DERPRegionToProto(region *tailcfg.DERPRegion) *proto.DERPMap_Region {
169 if region == nil {

Callers 7

TestGetManifestFunction · 0.92
GetManifestMethod · 0.92
ProtoFromManifestFunction · 0.92
TestDERPMapFunction · 0.92
StreamDERPMapsMethod · 0.85
TestTelemetryStoreFunction · 0.85
newEventMethod · 0.85

Calls 1

DERPRegionToProtoFunction · 0.85

Tested by 3

TestGetManifestFunction · 0.74
TestDERPMapFunction · 0.74
TestTelemetryStoreFunction · 0.68