Use a 3/4" square cutter. Work from the right side of the gun. Plane the right side and the top so they are 90 degrees to each other. Leave the forestock about one inch longer than necessary so you can cut it back to remove the starting cut. Mark where the breech of your barrel will be so you can stop before cutting too far.
Lay your barrel in front of the blank and draw its outline on the nose.
Using the line on the nose, set your fence to cut A. First to cut the right side of the channel (left side in picture) then extend fence to cut the remainder on the other side. Then repeat process and cut to line B.
You now have a square channel. Switch to a 45 degree cutter and cut to line C.
This will give your octagon and only require that a small amount of wood be chiseled off on the bottom flat. When done, cut from the nose to the breech along line A, or 1/2 the depth of the barrel.
To do a swamped barrel, you will have to make a fixture and use a bearing on your cutters. Cut 2 1" pieces of Masonite and force them against the barrel to match its profile. Then screw them tight. You will have to cut to the narrowest dimension of the barrel and then make short progressive cuts to deepen the swamp.
I do this free hand rather than on a table, as the chips will build up in the channel and force the cutter off track.