@ -67,6 +67,8 @@ var handler = map[string]localAPIHandler{
"component-debug-logging" : ( * Handler ) . serveComponentDebugLogging ,
"debug" : ( * Handler ) . serveDebug ,
"debug-derp-region" : ( * Handler ) . serveDebugDERPRegion ,
"debug-packet-filter-matches" : ( * Handler ) . serveDebugPacketFilterMatches ,
"debug-packet-filter-rules" : ( * Handler ) . serveDebugPacketFilterRules ,
"derpmap" : ( * Handler ) . serveDERPMap ,
"dev-set-state-store" : ( * Handler ) . serveDevSetStateStore ,
"dial" : ( * Handler ) . serveDial ,
@ -506,6 +508,40 @@ func (h *Handler) serveDevSetStateStore(w http.ResponseWriter, r *http.Request)
io . WriteString ( w , "done\n" )
}
func ( h * Handler ) serveDebugPacketFilterRules ( w http . ResponseWriter , r * http . Request ) {
if ! h . PermitWrite {
http . Error ( w , "debug access denied" , http . StatusForbidden )
return
}
nm := h . b . NetMap ( )
if nm == nil {
http . Error ( w , "no netmap" , http . StatusNotFound )
return
}
w . Header ( ) . Set ( "Content-Type" , "application/json" )
enc := json . NewEncoder ( w )
enc . SetIndent ( "" , "\t" )
enc . Encode ( nm . PacketFilterRules )
}
func ( h * Handler ) serveDebugPacketFilterMatches ( w http . ResponseWriter , r * http . Request ) {
if ! h . PermitWrite {
http . Error ( w , "debug access denied" , http . StatusForbidden )
return
}
nm := h . b . NetMap ( )
if nm == nil {
http . Error ( w , "no netmap" , http . StatusNotFound )
return
}
w . Header ( ) . Set ( "Content-Type" , "application/json" )
enc := json . NewEncoder ( w )
enc . SetIndent ( "" , "\t" )
enc . Encode ( nm . PacketFilter )
}
func ( h * Handler ) serveComponentDebugLogging ( w http . ResponseWriter , r * http . Request ) {
if ! h . PermitWrite {
http . Error ( w , "debug access denied" , http . StatusForbidden )