Well, you're off to a good start.
You perceived a potential threat.
Now you have to assess and address the threat. And Very Quickly. (You're already a little bit behind the power curve because you shoulda thought about the threat before you opened the door. Maybe just a bit, while you poked your head out just enough to see. Then you coulda pulled back, shut the door and the suspect woulda been locked out. And you'd be safe.)
Possibilities to consider: The "man with a gun" may be a Fellow Forum Member who is simply open carrying. Or the man may be going to the gunsmith next door. He may be a police officer responding to a call (in which case, he may think that You are the perp.) He may be George Zimmerman on neighborhood patrol. He might be a private security guard.
You've got to sort it all out quickly. Instantly.
If the gun is pointed at you, then the situation clarifies. Now you fear for your life or great bodily harm.
Question: Do You have a firearm or defensive weapon with you? (You didn't say.)
If so, you might consider accessing your weapon during the nanosecond that you have.
Now, If the gun is pointed at you or if the man makes any kind of aggressive act, then you've got to instantly decide whether to (a) retreat or (b) defend yourself, possibly with any lethal force that you have available.
If you can retreat and know that you can do so with safety, then Nebraska law requires you to do so.
If you cannot retreat and you fear death or great bodily harm (and you'll have to have some kind of very strong reason in court), then you may use lethal force.
How Much? Enough to stop the attack. You don't want to kill anybody. You just want to stop the attack. When the attack is over, go to an immediate safe space (if available), call 911, stow your defensive device (if applicable), have your hands empty, and await law enforcement.
When the LEOs arrive, tell them that a self-defense event has taken place, give them your name and address, tell them that you need legal counsel to determine your rights before you make a formal statement ("lawyer up"), and say no more.
Most likely, you'll be handcuffed and taken to jail. All the LEOs know is that two guys with guns (if you had one) were blazing away, one is down, so take one to the hospital (or morgue) and the other to jail until it all gets sorted out.
That's just the Beginning.
[BTW: Castle Doctrine probably won't apply here, unless the door is your own front door or the door of your workplace. Even then it starts to get gray because you are outside, not inside.]