server/shadow: split into library + executable