I have to agree with markbarendt. I installed two isolation transformers, one for each shore power line coming into my boat. I installed the 'Charles 3.6' Iso Transformer. They completely isolate the boat not only from power surges, but as well as galvanic corrosion. My dock neighbor, in fact our marina got hit by lightning at the end of the '19 season. Blew out the inground sprinkler system. My dock neighbor and others in the marina had their electronics fried because of the strike. I had no idea that it happened. Nothing on my boat affected.
A marine electrician, whom I've had other work done was discussing the strike with my dock mate and I mentioned the Isolation Transformers, he said it totally saved my boat from any damage.
They aren't cheap and require some heavy wire and a dual-pole breaker in line before the transformer, but I installed mine in less than a day. Only down side is that I have shore power inlets on both sides of the boat. Since while at my dock, I'm tied up Port side to, I installed on the Port side. If I tie up at a marina on the starboard side, I run my shore power cords to the port side inlets.