Porting timeout option from got

Add timeout option.